diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..ce11384a2 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "hal"] + path = hal + url = https://github.com/kinsamanka/machinekit-hal.git diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000..a971e525b --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,50 @@ +cmake_minimum_required(VERSION 3.0.2) + +project(machinekit-cnc) + +include(CheckIncludeFiles) + +set(MK_VERSION_MAJOR 0) +set(MK_VERSION_MINOR 3) + +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake") +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) + +set(PROJECT_PYTHON_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/python) +set(PROJECT_LIBEXEC_DIR ${PROJECT_BINARY_DIR}/lib/machinekit) +set(PROJECT_LIB_DIR ${PROJECT_BINARY_DIR}/lib) +set(PROJECT_SYSCONF_DIR ${PROJECT_BINARY_DIR}/etc) +set(PROJECT_BIN_DIR ${PROJECT_BINARY_DIR}/bin) +set(PROJECT_DATA_DIR ${PROJECT_BINARY_DIR}/share/machinekit) +set(PROJECT_LOCALE_DIR ${PROJECT_DATA_DIR}/locale) +set(PROJECT_MAN_DIR ${PROJECT_BINARY_DIR}/man) +set(INCLUDE_DIR ${PROJECT_BINARY_DIR}/include) +set(SCRIPTS_DIR ${CMAKE_SOURCE_DIR}/scripts) +set(PROJECT_TCL_DIR ${PROJECT_BINARY_DIR}/lib/tcltk) + +if("${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr") + set(INSTALL_SYSCONF_DIR "/etc") +else() + set(INSTALL_SYSCONF_DIR "${CMAKE_INSTALL_PREFIX}/etc") +endif() + +include(Options) +include(Dependencies) +include(Macros) + +include_directories(${INCLUDE_DIR}) + +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + +add_subdirectory(src) +add_subdirectory(scripts) +#add_subdirectory(po) + + +# Note, maybe this should source from ? +# Setting the include directory for the application to find config.h +#include_directories( ${CMAKE_BINARY_DIR} ) +# Since we have created a config.h add a global define for it +#add_definitions( "-DHAVE_CONFIG_H" ) diff --git a/VERSION b/VERSION index 3b04cfb60..be5863417 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.2 +0.3 diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake new file mode 100644 index 000000000..c0521885b --- /dev/null +++ b/cmake/Dependencies.cmake @@ -0,0 +1,301 @@ +include(FindPkgConfig) +if(NOT PKG_CONFIG_FOUND) + message(FATAL_ERROR "pkg-config not found: install pkg-config") +endif() + +# check debian version +execute_process(COMMAND lsb_release -rs + OUTPUT_VARIABLE RELEASE_NUMBER + OUTPUT_STRIP_TRAILING_WHITESPACE) + +if(RELEASE_NUMBER VERSION_GREATER "9.99") + set(GT_STRETCH 1) +endif() + +if(NOT CMAKE_VERSION VERSION_LESS "3.12") + find_package(Python2 COMPONENTS Interpreter Development) +else() + find_package(Python2_local) +endif() +set(HAVE_PYTHON ${Python2_VERSION}) + +if(NOT IS_DIRECTORY ${Python2_SITELIB}/google/protobuf) + message(FATAL_ERROR "python-protobuf not found: install python-protobuf") +endif() + +pkg_check_modules(AVAHI avahi-client) +if(NOT AVAHI_FOUND) + message(FATAL_ERROR "avahi-client not found: install libavahi-client-dev") +endif() +set(HAVE_AVAHI 1) + +find_program(CYTHON cython) +if(NOT CYTHON) + message(FATAL_ERROR "cython not found: install cython") +endif() + +set(Python_ADDITIONAL_VERSIONS 2.7) +find_package(PythonLibs REQUIRED) + +find_package(Boost COMPONENTS python27 thread) +if(NOT Boost_FOUND) + message(FATAL_ERROR "boost not found: install libboost-python-dev") +endif() +set(HAVE_BOOST 1) +set(HAVE_BOOST_PYTHON 1) + +pkg_check_modules(LCG libcgroup) +if(NOT LCG_FOUND) + message(FATAL_ERROR "libcgroup not found: install libcgroup-dev") +endif() +set(HAVE_LIBCGROUP 1) + +pkg_check_modules(LCK ck) +if(LCK_FOUND) + set(HAVE_CK 1) +else() + message("libck-dev not found: install libck-dev") +endif() + +pkg_check_modules(CZMQ libczmq>=4.0.2) +if(NOT CZMQ_FOUND) + message(FATAL_ERROR "libczmq not found: install libczmq-dev") +endif() +set(HAVE_CZMQ 1) + +if(WITH_GTK) + find_package(GTK2 REQUIRED) + if(NOT GTK2_FOUND) + message(FATAL_ERROR "libgtk2.0 not found: install libgtk2.0-dev") + endif() + set(HAVE_GTK 1) + pkg_check_modules(GLU glu) + if(NOT GLU_FOUND) + message(FATAL_ERROR "libglu1-mesa-dev not found: install libglu1-mesa-dev") + endif() + set(HAVE_GLU 1) + pkg_check_modules(GL gl) + if(NOT GL_FOUND) + message(FATAL_ERROR "libgl-dev not found: install libgl-dev") + endif() + set(HAVE_GL 1) + pkg_check_modules(XAW xaw7) + if(NOT XAW_FOUND) + message(FATAL_ERROR "libxaw7-dev not found: install libxaw7-dev") + endif() + set(HAVE_XAW 1) + pkg_check_modules(X11 x11) + if(NOT X11_FOUND) + message(FATAL_ERROR "libx11-dev not found: install libx11-dev") + endif() + set(HAVE_X11 1) + pkg_check_modules(XINERAMA xinerama) + if(NOT XINERAMA_FOUND) + message(FATAL_ERROR "libXinerama-dev not found: install libXinerama-dev") + endif() + set(HAVE_XINERAMA 1) +endif() + +pkg_check_modules(JANSSON jansson>=2.5) +if(NOT JANSSON_FOUND) + message(FATAL_ERROR "jansson not found: install libjansson-dev") +endif() +set(HAVE_JANSSON 1) + +include(FindTCL) +if(NOT TCL_FOUND) + message(FATAL_ERROR "tcl not found: install tcl8.6-dev") +endif() + +if(WITH_MODBUS) + pkg_check_modules(MODBUS libmodbus>=3) + if(NOT MODBUS_FOUND) + message(FATAL_ERROR "libmodbus not found: install libmodbus-dev") + endif() +endif() + +if(CMAKE_VERSION VERSION_LESS "3.6") + find_package(Protobuf) + set(Protobuf_FOUND ${PROTOBUF_FOUND}) + set(Protobuf_INCLUDE_DIR ${PROTOBUF_INCLUDE_DIRS}) +else() + find_package(Protobuf 2.4.1) +endif() + +if(NOT Protobuf_FOUND) + message(FATAL_ERROR "protobuf not found: install libprotobuf-dev") +endif() +set(HAVE_PROTOBUF 1) + +if(WITH_LIBUSB10) + pkg_check_modules(LIBUSB libusb-1.0) + if(NOT LIBUSB_FOUND) + message(FATAL_ERROR "libusb not found: install libusb-1.0-0-dev") + endif() +endif() + +pkg_check_modules(LWS libwebsockets) +if(NOT LWS_FOUND) + message(FATAL_ERROR "websockets not found: install libwebsockets-dev") +endif() +set(HAVE_LWS 1) + +find_program(PROTOC protoc) +if(NOT PROTOC) + message(FATAL_ERROR "protoc not found: install protobuf-compiler") +endif() + +find_program(PATCHELF patchelf) +if(NOT PATCHELF) + message(FATAL_ERROR "patchelf not found: install patchelf") +endif() + +pkg_check_modules(UUID uuid) +if(NOT UUID_FOUND) + message(FATAL_ERROR "uuid not found: install uuid-dev") +endif() +set(HAVE_UUID 1) + +if(GT_STRETCH) + find_program(YAPPS yapps2) +else() + find_program(YAPPS yapps) +endif() +if(NOT YAPPS) + message(FATAL_ERROR "yapps not found: install yapps2 package") +endif() + +if(GT_STRETCH) + if(NOT IS_DIRECTORY ${Python2_SITELIB}/yapps) + message(FATAL_ERROR "python-yapps not found: install python-yapps") + endif() +endif() + +# Note: cludge TARGET_ARCH for cross-compiling support +if(NOT TARGET_ARCH) + # Find the machine type + execute_process( + COMMAND uname -m + OUTPUT_VARIABLE MACHINE_TYPE + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + + set(TARGET_ARCH ${MACHINE_TYPE}) +endif() + +check_include_file(readline/readline.h HAVE_READLINE_INC) +find_library(HAVE_READLINE_LIB readline HINTS /usr/lib/${TARGET_ARCH}-linux-gnu) +if(HAVE_READLINE_INC AND HAVE_READLINE_LIB) + set(READLINE_LIBRARY_PATH "/usr/lib/${TARGET_ARCH}-linux-gnu") + message("/usr/lib/${TARGET_ARCH}-linux-gnu") +else() + message(FATAL_ERROR "readline not found: install libreadline-dev") +endif() + +find_package(Threads REQUIRED) + +find_program(CCACHE_FOUND ccache) +if(CCACHE_FOUND) + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) + set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) +endif(CCACHE_FOUND) + +if(WITH_USERMODE_PCI) + pkg_check_modules(UDEV libudev) + if(NOT UDEV_FOUND) + message(FATAL_ERROR "udev not found: install libudev-dev") + endif() + set(HAVE_LIBUDEV 1) +endif() + +find_program(PIDOF pidof) +if(NOT PIDOF) + message(FATAL_ERROR "pidof not found: install sysvinit-utils") +endif() + +find_program(PS ps) +find_program(AWK awk) + +pkg_check_modules(SSL REQUIRED libssl) +pkg_check_modules(URIPARSER liburiparser) +if(NOT URIPARSER_FOUND) + message(FATAL_ERROR "liburiparser not found: install liburiparser-dev") +endif() + +pkg_check_modules(TK_DEV tk) +if(NOT TK_DEV_FOUND) + message(FATAL_ERROR "tk-dev not found: install tk-dev") +endif() + +if(WITH_POSIX) + set(CMAKE_THREAD_PREFER_PTHREAD TRUE) + set(THREADS_PREFER_PTHREAD_FLAG TRUE) + find_package(Threads) + if(NOT THREADS_FOUND) + message(FATAL_ERROR "POSIX threads not found!") + endif() + set(HAVE_POSIX_THREADS 1) +elseif(WITH_RT_PREEMPT) + include(FindThreads) + if(NOT THREADS_FOUND) + message(FATAL_ERROR "RT_PREEMPT threads not found!") + endif() + set(HAVE_PREEMPT_THREADS 1) +elseif(WITH_XENOMAI) + include(FindThreads) + if(NOT THREADS_FOUND) + message(FATAL_ERROR "XENOMAI threads not found!") + endif() + set(HAVE_XENOMAI_THREADS 1) +elseif(WITH_XENOMAI_KERNEL) + include(FindThreads) + if(NOT THREADS_FOUND) + message(FATAL_ERROR "XENOMAI_KERNEL threads not found!") + endif() + set(HAVE_XENOMAI_KERNEL_THREADS 1) +elseif(WITH_RTAI_KERNEL) + include(FindThreads) + if(NOT THREADS_FOUND) + message(FATAL_ERROR "RTAI_KERNEL threads not found!") + endif() + set(HAVE_RTAI_KERNEL_THREADS 1) +else() + message(FATAL "No thread support selected!") +endif() + +# Define to 1 if asm/msr.h is usable and defines rdtscll +check_symbol_exists(rdtscll "asm/msr.h" MSR_H_USABLE) + +if(MSR_H_USABLE) + set(HAVE_MSR_H_USABLE) +endif() + +# Define to 1 if linux/hidraw.h is usable and defines HIDIOCGRAWINFO +check_symbol_exists(HIDIOCGRAWINFO "linux/hidraw.h" HIDRAW_H_USABLE) + +if(HIDRAW_H_USABLE) + set(HAVE_HIDRAW_H_USABLE) +endif() + +pkg_check_modules(LTTNG_UST lttng-ust) +if(NOT HAVE_LTTNG_UST) + message("lttng-ust not found: install liblttng-ust-dev") +endif() + +pkg_check_modules(LIBBACKTRACE libbacktrace) + +# The installation location of machinekit-hal +find_path(mkHalIncludes hal.h PATHS /usr/local/include/machinekit ${MACHINEKIT_INCLUDE_DIR}) +if(NOT mkHalIncludes) + message(FATAL_ERROR "Can't find machinekit-hal include directory, try setting MACHINEKIT_INCLUDE_DIR") +endif() +include_directories(${mkHalIncludes}) + +# Needed for libnml +find_library(rtapi_math MACHINEKIT_RTAPI_MATH_FOUND) + +include(FindGettext) + +include(FindKernelHeaders) + +include(FindCurses) diff --git a/cmake/FindKernelHeaders.cmake b/cmake/FindKernelHeaders.cmake new file mode 100644 index 000000000..a78fa1509 --- /dev/null +++ b/cmake/FindKernelHeaders.cmake @@ -0,0 +1,48 @@ +# +# Source: https://github.com/davidsansome/trochus/blob/master/cmake/FindKernelHeaders.cmake +# +# Find the kernel release, omit the arch +execute_process( + COMMAND uname -r + COMMAND cut "-f1" "-d-" + OUTPUT_VARIABLE KERNEL_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE +) + +file(GLOB COMMON_HEADER_DIRS /usr/src/linux-headers-${KERNEL_VERSION}*-common) + +# Find the headers +find_path(COMMON_KERNELHEADERS_DIR + include/linux/device.h + PATHS ${COMMON_HEADER_DIRS} /usr/src/linux-headers-${KERNEL_VERSION}-common +) + +file(GLOB HEADER_DIRS /usr/src/linux-headers-${KERNEL_VERSION}*) +list(FILTER HEADER_DIRS EXCLUDE REGEX "common$") + +find_path(KERNELHEADERS_DIR + include/generated/bounds.h + PATHS ${HEADER_DIRS} /usr/src/linux-headers-${KERNEL_RELEASE} +) + +message(STATUS "Kernel release: ${KERNEL_RELEASE}") +message(STATUS "Kernel headers: ${KERNELHEADERS_DIR}") +message(STATUS "Kernel headers (common): ${COMMON_KERNELHEADERS_DIR}") + +if (KERNELHEADERS_DIR) + set(KERNELHEADERS_INCLUDE_DIRS + ${KERNELHEADERS_DIR}/include + ${KERNELHEADERS_DIR}/arch/x86/include + ${KERNELHEADERS_DIR}/arch/x86/include/generated + ${COMMON_KERNELHEADERS_DIR}/include + ${COMMON_KERNELHEADERS_DIR}/arch/x86/include + ${COMMON_KERNELHEADERS_DIR}/arch/x86/include/generated + CACHE PATH "Kernel headers include dirs" + ) + message(STATUS "Kernel header directories: ${KERNELHEADERS_INCLUDE_DIRS}") + set(KERNELHEADERS_FOUND 1 CACHE STRING "Set to 1 if kernel headers were found") +else (KERNELHEADERS_DIR) + set(KERNELHEADERS_FOUND 0 CACHE STRING "Set to 1 if kernel headers were found") +endif (KERNELHEADERS_DIR) + +mark_as_advanced(KERNELHEADERS_FOUND) diff --git a/cmake/Macros.cmake b/cmake/Macros.cmake new file mode 100644 index 000000000..82106a53a --- /dev/null +++ b/cmake/Macros.cmake @@ -0,0 +1,251 @@ +#! _mkiconv : this macro creates conv_IN_OUT.icomp from conv.icomp.in +# +# this calls the mkconv.sh script with the required parameters +# +# the list of generated comp files ${_gen_comp} is then updated after the macro ends +# +# \arg:NAME name of the output file +# \arg:ARGS list of arguments needed by mkconv.sh +# +macro(_mkconv NAME ARGS) + set(_args "${ARGS}") + set(_comp "${CMAKE_CURRENT_BINARY_DIR}/${NAME}.icomp") + add_custom_command( + OUTPUT ${_comp} + COMMAND bash mkconv.sh ${_args} < conv.icomp.in > ${_comp} + DEPENDS mkconv.sh conv.icomp.in instcomp + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + set(_gen_comp ${_gen_comp} ${_comp}) +endmacro() + +#! _comp_to_c : this macro generates c source files from comp file +# +# the list of generated c files ${_gen_c} is updated after the macro ends +# +# \arg:NAME comp src file without the extension +# \arg:DIR Optional, source directory +# +macro(_comp_to_c NAME) + if(NOT ${ARGV1}) + set(_wdir ${ARGV1}) + else() + set(_wdir ${CMAKE_CURRENT_SOURCE_DIR}) + endif() + set(_c "${CMAKE_CURRENT_BINARY_DIR}/${NAME}.c") + add_custom_command( + OUTPUT ${_c} + COMMAND ${PROJECT_BIN_DIR}/comp + --require-license -o ${_c} ${NAME}.comp + DEPENDS ${_wdir}/${NAME}.comp comp + WORKING_DIRECTORY ${_wdir}) + set(_gen_c ${_gen_c} ${_c}) +endmacro() + +#! _comp_to_man : this macro generates manpages from comp file +# +# the list of generated manpages ${_gen_man} is updated after the macro ends +# +# \arg:NAME comp src file without the extension +# \arg:DIR Optional, source directory +# +macro(_comp_to_man NAME) + if(WITH_DOCUMENTATION) + if(NOT ${ARGV1}) + set(_wdir ${ARGV1}) + else() + set(_wdir ${CMAKE_CURRENT_SOURCE_DIR}) + endif() + set(_man "${PROJECT_MAN_DIR}/man9/${NAME}.9comp") + add_custom_command( + OUTPUT ${_man} + COMMAND ${PROJECT_BIN_DIR}/comp + --document -o ${_man} ${NAME}.comp + DEPENDS ${_wdir}/${NAME}.comp comp + WORKING_DIRECTORY ${_wdir}) + set(_gen_man ${_gen_man} ${_man}) + endif() +endmacro() + +#! _icomp_to_c : this macro generates c source files from icomp file +# +# the list of generated c files ${_gen_c} is updated after the macro ends +# +# \arg:NAME icomp src file without the extension +# \arg:DIR Optional, source directory +# +macro(_icomp_to_c NAME) + if(NOT ${ARGV1}) + set(_wdir ${ARGV1}) + else() + set(_wdir ${CMAKE_CURRENT_SOURCE_DIR}) + endif() + set(_c "${CMAKE_CURRENT_BINARY_DIR}/${NAME}.c") + add_custom_command( + OUTPUT ${_c} + COMMAND ${PROJECT_BIN_DIR}/instcomp + --require-license -o ${_c} ${NAME}.icomp + DEPENDS ${_wdir}/${NAME}.icomp instcomp + WORKING_DIRECTORY ${_wdir}) + set(_gen_c ${_gen_c} ${_c}) +endmacro() + +#! _icomp_to_man : this macro generates manpages from icomp file +# +# the list of generated manpages ${_gen_man} is updated after the macro ends +# +# \arg:NAME comp src file without the extension +# \arg:DIR Optional, source directory +# +macro(_icomp_to_man NAME) + if(WITH_DOCUMENTATION) + if(NOT ${ARGV1}) + set(_wdir ${ARGV1}) + else() + set(_wdir ${CMAKE_CURRENT_SOURCE_DIR}) + endif() + set(_man "${PROJECT_MAN_DIR}/man9/${NAME}.9comp") + add_custom_command( + OUTPUT ${_man} + COMMAND ${PROJECT_BIN_DIR}/instcomp + --document -o ${_man} ${NAME}.icomp + DEPENDS ${_wdir}/${NAME}.icomp instcomp + WORKING_DIRECTORY ${_wdir}) + set(_gen_man ${_gen_man} ${_man}) + endif() +endmacro() + +#! _flavor_helper : helper macro +# +# sets FLAV to uppercase and stores in _FLAV +# _fname is the defined flavor name +# _fid is thread flavor id +# +# \arg:FLAV flavor name +# +macro(_flavor_helper FLAV) + string(TOUPPER ${FLAV} _FLAV) + set(_fname ${RTAPI_${_FLAV}_NAME}) + set(_fid ${RTAPI_${_FLAV}_ID}) +endmacro() + +#! _to_rtlib : this macro generates a single rt binary and then creates +# symlinks all flavors +# +# \arg:NAME library name +# \arg:SRCS sources +# \arg:CFLAGS Optional, additional flags +# +macro(_to_rtlib NAME SRCS) + set(_cflags -UULAPI) + if(${ARGV1}) + set(_cflags -UULAPI ${ARGV1}) + endif() + string(REGEX REPLACE "\\.i?comp" "" _name ${NAME}) + add_library(${NAME} SHARED ${SRCS}) + set_target_properties(${NAME} PROPERTIES + COMPILE_DEFINITIONS "RTAPI;THREAD_FLAVOR_ID=0" + COMPILE_FLAGS ${_cflags} + LIBRARY_OUTPUT_DIRECTORY ${PROJECT_LIBEXEC_DIR}/modules + OUTPUT_NAME ${_name} + PREFIX "") + install(TARGETS ${NAME} LIBRARY DESTINATION lib/machinekit/modules) + + foreach(_flav ${BUILD_THREAD_FLAVORS}) + _flavor_helper(${_flav}) + add_custom_command(OUTPUT ${PROJECT_LIBEXEC_DIR}/${_fname}/${_name}.so + COMMAND ${CMAKE_COMMAND} -E create_symlink ../modules/${_name}.so + ${PROJECT_LIBEXEC_DIR}/${_fname}/${_name}.so + DEPENDS ${NAME} + COMMENT "Symlinking ${_fname}/${_name}.so to ../modules/${_name}.so") + add_custom_target(${_name}.${_fname} ALL DEPENDS ${PROJECT_LIBEXEC_DIR}/${_fname}/${_name}.so) + install(CODE "execute_process( + COMMAND ${CMAKE_SOURCE_DIR}/cmake/create_rt_links + ${CMAKE_INSTALL_PREFIX} ${_fname} ${_name})" + VERBATIM) + endforeach() +endmacro() + +#! _install* : these are install helper macros +# +macro(_install SRC) + install(TARGETS ${SRC} + DESTINATION bin + LIBRARY DESTINATION lib) +endmacro() + +macro(_install_exec SRC) + set(_lib_dest lib/machinekit) + if(NOT ${ARGV1}) + set(_lib_dest lib/machinekit/${ARGV1}) + endif() + install(TARGETS ${SRC} + DESTINATION lib/machinekit + LIBRARY DESTINATION ${_lib_dest}) +endmacro() + +macro(_install_exec_flavor SRC) + foreach(_flav ${BUILD_THREAD_FLAVORS}) + _flavor_helper(${_flav}) + set(_lib_dest lib/machinekit/${_fname}) + install(TARGETS ${SRC}_${_fname}_ + DESTINATION lib/machinekit + LIBRARY DESTINATION ${_lib_dest}) + endforeach() +endmacro() + +macro(_install_exec_setuid SRC) + set(_lib_dest lib/machinekit) + if(NOT ${ARGV1}) + set(_lib_dest lib/machinekit/${ARGV1}) + endif() + install(TARGETS ${SRC} + DESTINATION lib/machinekit + PERMISSIONS SETUID + OWNER_WRITE OWNER_READ OWNER_EXECUTE + GROUP_READ GROUP_EXECUTE + WORLD_EXECUTE WORLD_READ + LIBRARY DESTINATION ${_lib_dest}) +endmacro() + +macro(_install_man SRC) + install(FILES ${SRC} + DESTINATION man/man9) +endmacro() + +macro(_install_script SRC) + install(PROGRAMS ${SRC} + DESTINATION bin) +endmacro() + +# *** _install *** + +#! add_python_target : add python executable target/s +# +# This macro performs syntax checking on python files and copies +# it to the destination dir. Renames the file depending on ${ext} parameter +# +# \arg:TGT python target +# \arg:DST output destination directory +# \arg:EXT output extension +# \arg:SDIR source destination directory +# \arg:ARGN python source file/s +# +macro(add_python_target TGT DST EXT SDIR) + unset(_out_files) + separate_arguments(_py_cmd UNIX_COMMAND + "-c 'import sys\; compile(open(sys.argv[1]).read(), sys.argv[1], \"exec\")'") + separate_arguments(_sed_cmd UNIX_COMMAND + "'1s-^#!.*-#!${Python2_EXECUTABLE}-'") + foreach(_x ${ARGN}) + set(_out ${DST}/${_x}${EXT}) + list(APPEND _out_files ${_out}) + add_custom_command(OUTPUT ${_out} + COMMAND ${Python2_EXECUTABLE} ${_py_cmd} ${SDIR}/${_x}.py + COMMAND sed ${_sed_cmd} ${SDIR}/${_x}.py > ${_out} + COMMAND chmod +x ${_out} + DEPENDS ${SDIR}/${_x}.py + COMMENT "Creating ${_out}" + VERBATIM) + endforeach() + add_custom_target(${TGT} ALL DEPENDS ${_out_files}) +endmacro() diff --git a/cmake/Options.cmake b/cmake/Options.cmake new file mode 100644 index 000000000..94fb6698c --- /dev/null +++ b/cmake/Options.cmake @@ -0,0 +1,219 @@ +# Options + +cmake_minimum_required(VERSION 2.8) + +# Option to build asciidoc documentation +option( WITH_DOCUMENTATION "Build asciidoc documentation" OFF ) + +# Option to build unstable development code +option( WITH_DEV "Build unstable development code" OFF ) + +# Option to hardware drivers +option( WITH_DRIVERS "Build the hardware drivers" ON ) + +# Option to build the emcweb interface +option( WITH_EMCWEB "Build the emcweb interface" ON ) + +# Option to build included programming examples +option( WITH_EXAMPLES "Build included programming examples" ON ) + +# Option to enable the parts of Machinekit that depend on GTK +option( WITH_GTK "Enable the parts of Machinekit that depend on GTK" ON ) + +# Option to not use NLS +option( WITH_NLS "Enable NLS" ON ) + +# Option to enable NML-using parts +option( WITH_NML "Enable NML" ON ) + +# Option to build hal_parport using the ppdev ioctl instead of inb/outb +option( WITH_PORTABLE_PARPORT "Build hal_parport using the ppdev ioctl instead of inb/outb" OFF ) + +# Option to build Javascript bindings based on https://github.com/dcodeIO/ProtoBuf.js/wiki +option( WITH_PROTO_JS "Build Javascript bindings based on https://github.com/dcodeIO/ProtoBuf.js/wiki" ON ) + +# Option to enable python-pydot graphing +option( WITH_PYDOT "Enable python-pydot graphing" ON ) + +# Option to enable the parts of Machinekit that depend on Python +option( WITH_PYTHON "Enable the parts of Machinekit that depend on Python" ON ) + +# Option to enable remote zeroMQ services +option( WITH_REMOTE "Enable remote zeroMQ services" OFF ) + +# Option to use the common shared memory driver kernel module +option( WITH_SHMDRV "Use the common shared memory driver kernel module" OFF ) + +# Option to build PCI drivers with usermode PCI support +option( WITH_USERMODE_PCI "Build PCI drivers with usermode PCI support" ON ) + +# Option to enable webtalk +option( WITH_WEBTALK "Enable webtalk" ON ) + +option( WITH_RUN_IN_PLACE "Enable run-in-place (RIP)" OFF ) + +option(WITH_PC "Build for PC platform (default)" ON) +option(WITH_BEAGLEBONE "Build for Beaglebone platform" OFF) +option(WITH_CHIP "Build for Chip platform" OFF) +option(WITH_H3 "Build for H3 SoC platform" OFF) +option(WITH_RASPBERRY "Build for Raspberry" OFF) +option(WITH_SOCFPGA "Build for Socfpga platform" OFF) +option(WITH_ZEDBOARD "Build for Zedboard platform" OFF) + +if(WITH_PC) + set(TARGET_PLATFORM_PC 1) +elseif(WITH_BEAGLEBONE) + set(TARGET_PLATFORM_BEAGLEBONE 1) +elseif(WITH_CHIP) + set(TARGET_PLATFORM_CHIP 1) +elseif(WITH_H3) + set(TARGET_PLATFORM_H3 1) +elseif(WITH_RASPBERRY) + set(TARGET_PLATFORM_RASPBERRY 1) +elseif(WITH_SOCFPGA) + set(TARGET_PLATFORM_SOCFPGA 1) +elseif(WITH_ZEDBOARD) + set(TARGET_PLATFORM_ZEDBOARD 1) +endif() + +option(WITH_POSIX "Build with POSIX thread support" ON) +option(WITH_RT_PREEMPT "Build with RT_PREEMPT thread support" OFF) +option(WITH_XENOMAI "Build with Xenomai userland thread support" OFF) +option(WITH_XENOMAI_KERNEL "Build Xenomai kernel thread support" OFF) +option(WITH_RTAI_KERNEL "Build RTAI thread support" OFF) + +if(WITH_RT_PREEMPT) + set(HAVE_RT_PREEMPT_THREADS 1) + add_definitions(-DRTAPI) + set(BUILD_THREAD_FLAVORS rt_preempt) +endif() + +if(WITH_POSIX) + set(HAVE_POSIX_THREADS 1) + add_definitions(-DULAPI) + set(BUILD_THREAD_FLAVORS ${BUILD_THREAD_FLAVORS} posix) +endif() + +find_program(XENO_CONFIG xeno-config) +if(NOT XENO_CONFIG OR NOT WITH_XENOMAI) + message(STATUS "xenomai flavor disabled") + set(XENOMAI_SKIN native) +else() + set(BUILD_THREAD_FLAVORS ${BUILD_THREAD_FLAVORS} xenomai) + set(HAVE_XENOMAI_THREADS 1) + execute_process(COMMAND ${XENO_CONFIG} --version + OUTPUT_VARIABLE XENO_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(XENO_VERSION MATCHES "^2.*") + set(XENOMAI_SKIN native) + set(XENOMAI_V2 1) + else() + set(XENOMAI_SKIN alchemy) + endif() + execute_process(COMMAND ${XENO_CONFIG} --skin ${XENOMAI_SKIN} --cflags + OUTPUT_VARIABLE XENO_CFLAGS + OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND ${XENO_CONFIG} --skin ${XENOMAI_SKIN} --ldflags + OUTPUT_VARIABLE XENO_LDFLAGS + OUTPUT_STRIP_TRAILING_WHITESPACE) +endif() + +set(RTAPI_POSIX_ID 0) +set(RTAPI_POSIX_NAME "posix") +set(POSIX_THREADS_SOURCE "rt-preempt.c") +set(POSIX_THREADS_RTFLAGS "-pthread") +set(POSIX_THREADS_LDFLAGS "-lpthread -lrt") +set(RTAPI_RT_PREEMPT_ID 1) +set(RTAPI_RT_PREEMPT_NAME "rt-preempt") +set(RT_PREEMPT_THREADS_SOURCE "rt-preempt.c") +set(RT_PREEMPT_THREADS_RTFLAGS "-pthread") +set(RT_PREEMPT_THREADS_LDFLAGS "-lpthread -lrt") +set(RTAPI_XENOMAI_ID 2) +set(RTAPI_XENOMAI_NAME "xenomai") +set(XENOMAI_THREADS_SOURCE "xenomai.c") +set(XENOMAI_THREADS_RTFLAGS "${XENO_CFLAGS}") +set(XENOMAI_THREADS_LDFLAGS "${XENO_LDFLAGS}") +set(RTAPI_XENOMAI_KERNEL_ID 3) +set(RTAPI_XENOMAI_KERNEL_NAME "xenomai-kernel") +set(RTAPI_RTAI_KERNEL_ID 4) +set(RTAPI_RTAI_KERNEL_NAME "rtai-kernel") + +if( WITH_DOCUMENTATION ) + message(" DOCUMENTATION Enabled") + set(BUILD_DOCUMENTATION 1) +endif( WITH_DOCUMENTATION ) +if( WITH_DEV ) + message(" DEV Enabled") + set(BUILD_DEV 1) +endif( WITH_DEV ) +if( WITH_DRIVERS ) + message(" DRIVERS Enabled") + set(BUILD_DRIVERS 1) +endif( WITH_DRIVERS ) +if( WITH_EMCWEB ) + message(" EMCWEB Enabled") + set(BUILD_EMCWEB 1) +endif( WITH_EMCWEB ) +if( WITH_EXAMPLES ) + message(" EXAMPLES Enabled") + set(BUILD_EXAMPLES 1) +endif( WITH_EXAMPLES ) +if( WITH_GTK ) + message(" GTK Enabled") + set(HAVE_GTK 1) +endif( WITH_GTK ) +if( WITH_NLS ) + message(" NLS Enabled") + set(HAVE_NLS 1) +endif( WITH_NLS ) +if( WITH_NML ) + message(" NML Enabled") + set(BUILD_NMLDEP 1) +endif( WITH_NML ) +if( WITH_PORTABLE_PARPORT ) + message(" PORTABLE_PARPORT Enabled") + set(USE_PORTABLE_PARPORT_IO 1) +endif( WITH_PORTABLE_PARPORT ) +if( WITH_PROTO_JS ) + message(" PROTO_JS Enabled") + set(HAVE_PROTO_JS 1) +endif( WITH_PROTO_JS ) +if( WITH_PYDOT ) + message(" PYDOT Enabled") +endif( WITH_PYDOT ) +if( WITH_PYTHON ) + message(" PYTHON Enabled") +endif( WITH_PYTHON ) +if( WITH_REMOTE ) + message(" REMOTE Enabled") +endif( WITH_REMOTE ) +if( WITH_SHMDRV ) + message(" SHMDRV Enabled") + set(USE_SHMDRV 1) +endif( WITH_SHMDRV ) +if( WITH_USERMODE_PCI ) + message(" USERMODE_PCI Enabled") + set(USERMODE_PCI 1) +endif( WITH_USERMODE_PCI ) +if( WITH_WEBTALK ) + message(" WEBTALK Enabled") + set(HAVE_WEBTALK) +endif( WITH_WEBTALK ) + +if (WITH_RUN_IN_PLACE) + add_definitions(-DRUN_IN_PLACE=yes) + set(EMC2_HOME ${PROJECT_SOURCE_DIR}) + add_definitions(-DEMC2_HOME="${EMC2_HOME}") + add_definitions(-DDEFAULT_NMLFILE="${EMC2_HOME}/configs/common/linuxcnc.nml") + add_definitions(-DDEFAULT_TOOLTABLE="${EMC2_HOME}/configs/sim/sim.tbl") + add_definitions(-DEMC2_NCFILES_DIR="${EMC2_HOME}/nc_files") +else() + add_definitions(-DRUN_IN_PLACE=no) + set(EMC2_HOME ${CMAKE_INSTALLATION_PREFIX}) + add_definitions(-DDEFAULT_NMLFILE="${EMC2_HOME}/share/common/linuxcnc.nml") + add_definitions(-DEMC2_DEFAULT_TOOLTABLE="") + add_definitions(-DEMC2_HOME="${EMC2_HOME}") + add_definitions(-DEMC2_NCFILES_DIR="${EMC2_HOME}/share/linuxcnc/ncfiles") +endif() + +set(USERPREIFX ${CMAKE_INSTALLATION_PREFIX}) diff --git a/cmake/link_headers.cmake b/cmake/link_headers.cmake new file mode 100644 index 000000000..8c9628ad7 --- /dev/null +++ b/cmake/link_headers.cmake @@ -0,0 +1,150 @@ +set(files + hal/lib/config_module.h + hal/lib/hal.h + hal/lib/hal_accessor.h + hal/lib/hal_accessor_macros.h + hal/lib/hal_group.h + hal/lib/hal_internal.h + hal/lib/hal_list.h + hal/lib/hal_logging.h + hal/lib/hal_object.h + hal/lib/hal_object_selectors.h + hal/lib/hal_parport.h + hal/lib/hal_priv.h + hal/lib/hal_rcomp.h + hal/lib/hal_ring.h + hal/lib/hal_types.h + hal/utils/halcmd_rtapiapp.h + libnml/inifile/inifile.h + libnml/inifile/inifile.hh + rtapi/multiframe.h + rtapi/multiframe_flag.h + rtapi/ring.h + rtapi/rtapi.h + rtapi/rtapi_app.h + rtapi/rtapi_atomics.h + rtapi/rtapi_bitops.h + rtapi/rtapi_byteorder.h + rtapi/rtapi_common.h + rtapi/rtapi_ctype.h + rtapi/rtapi_errno.h + rtapi/rtapi_exception.h + rtapi/rtapi_export.h + rtapi/rtapi_global.h + rtapi/rtapi_heap.h + rtapi/rtapi_heap_private.h + rtapi/rtapi_hexdump.h + rtapi/rtapi_int.h + rtapi/rtapi_io.h + rtapi/rtapi_math.h + rtapi/rtapi_math64.h + rtapi/rtapi_pci.h + rtapi/rtapi_shmkeys.h + rtapi/rtapi_string.h + rtapi/shmdrv/shmdrv.h + rtapi/rt-preempt.h + rtapi/rtapi_compat.h + rtapi/triple-buffer.h + rtapi/xenomai.h + machinetalk/protobuf/canon.npb.h + machinetalk/protobuf/canon.pb.h + machinetalk/protobuf/config.npb.h + machinetalk/protobuf/config.pb.h + machinetalk/protobuf/emcclass.npb.h + machinetalk/protobuf/emcclass.pb.h + machinetalk/protobuf/firmware.npb.h + machinetalk/protobuf/firmware.pb.h + machinetalk/protobuf/jplan.npb.h + machinetalk/protobuf/jplan.pb.h + machinetalk/protobuf/log.npb.h + machinetalk/protobuf/log.pb.h + machinetalk/protobuf/message.npb.h + machinetalk/protobuf/message.pb.h + machinetalk/protobuf/motcmds.npb.h + machinetalk/protobuf/motcmds.pb.h + machinetalk/protobuf/nanopb.npb.h + machinetalk/protobuf/nanopb.pb.h + machinetalk/protobuf/object.npb.h + machinetalk/protobuf/object.pb.h + machinetalk/protobuf/preview.npb.h + machinetalk/protobuf/preview.pb.h + machinetalk/protobuf/ros.npb.h + machinetalk/protobuf/ros.pb.h + machinetalk/protobuf/rtapi_message.npb.h + machinetalk/protobuf/rtapi_message.pb.h + machinetalk/protobuf/rtapicommand.npb.h + machinetalk/protobuf/rtapicommand.pb.h + machinetalk/protobuf/status.npb.h + machinetalk/protobuf/status.pb.h + machinetalk/protobuf/task.npb.h + machinetalk/protobuf/task.pb.h + machinetalk/protobuf/test.npb.h + machinetalk/protobuf/test.pb.h + machinetalk/protobuf/types.npb.h + machinetalk/protobuf/types.pb.h + machinetalk/protobuf/value.npb.h + machinetalk/protobuf/value.pb.h) + + +execute_process(COMMAND ${CMAKE_COMMAND} -E + make_directory ${INCLUDE_DIR}/protobuf) + +unset(_headers) +foreach(file ${files}) + get_filename_component(name ${file} NAME) + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink + ${CMAKE_SOURCE_DIR}/src/${file} ${INCLUDE_DIR}/${name}) + set(_headers ${_headers} ${INCLUDE_DIR}/${name}) +endforeach() + +foreach(file pb.h pb_decode.h pb_encode.h) + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink + ${CMAKE_SOURCE_DIR}/src/machinetalk/nanopb/${file} + ${INCLUDE_DIR}/protobuf/${file}) + set(_headers ${_headers} ${INCLUDE_DIR}/protobuf/${file}) +endforeach() + +if(WITH_USERMODE_PCI) + set(mesa_files + hal/drivers/mesa-hostmot2/bitfile.h + hal/drivers/mesa-hostmot2/hm2_pci.h + hal/drivers/mesa-hostmot2/hostmot2.h + hal/drivers/mesa-hostmot2/hm2_7i43.h + hal/drivers/mesa-hostmot2/hm2_soc_ol.h + hal/drivers/mesa-hostmot2/lbp16.h + hal/drivers/mesa-hostmot2/hm2_7i90.h + hal/drivers/mesa-hostmot2/hm2_test.h + hal/drivers/mesa-hostmot2/sserial.h + hal/drivers/mesa-hostmot2/hm2_eth.h + hal/drivers/mesa-hostmot2/hostmot2-lowlevel.h) + + execute_process(COMMAND ${CMAKE_COMMAND} -E + make_directory ${INCLUDE_DIR}/mesa + COMMAND ${CMAKE_COMMAND} -E + make_directory ${INCLUDE_DIR}/userpci) + + foreach(file ${mesa_files}) + get_filename_component(name ${file} NAME) + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink + ${CMAKE_SOURCE_DIR}/src/${file} + ${INCLUDE_DIR}/mesa/${name}) + set(_headers ${_headers} ${INCLUDE_DIR}/mesa/${name}) + endforeach() + + set(uspci_files + rtapi/userpci/device.h + rtapi/userpci/firmware.h + rtapi/userpci/gfp.h + rtapi/userpci/list.h + rtapi/userpci/module.h + rtapi/userpci/slab.h + rtapi/userpci/string.h) + + foreach(file ${uspci_files}) + get_filename_component(name ${file} NAME) + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink + ${CMAKE_SOURCE_DIR}/src/${file} + ${INCLUDE_DIR}/userpci/${name}) + set(_headers ${_headers} ${INCLUDE_DIR}/userpci/${name}) + endforeach() +endif() diff --git a/hal b/hal new file mode 160000 index 000000000..df5e884d3 --- /dev/null +++ b/hal @@ -0,0 +1 @@ +Subproject commit df5e884d31f8e2668ad80c1c2be66028a64cc3b4 diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt new file mode 100644 index 000000000..d65847d08 --- /dev/null +++ b/scripts/CMakeLists.txt @@ -0,0 +1,65 @@ +# TODO: replace all EMC2xx variables + +set(REALTIME ${PROJECT_BIN_DIR}/realtime) +set(EMC2_BIN_DIR ${PROJECT_BIN_DIR}) +set(EMC2_RTLIB_DIR ${PROJECT_LIBEXEC_DIR}) +set(prefix ${PROJECT_BINARY_DIR}) +set(exec_prefix ${PROJECT_BINARY_DIR}) +set(EMC2_SYSTEM_CONFIG_DIR ${PROJECT_SYSCONF_DIR}/machinekit) +set(EMC2_LIBEXEC_DIR ${PROJECT_LIBEXEC_DIR}) +set(EMC2_TCL_LIB_DIR ${PROJECT_TCL_DIR}) + +set(TCLSH ${TCL_TCLSH}) + +set(RUN_IN_PLACE "yes") +string(TIMESTAMP DATE UTC) +set(configure_input "built with cmake") + +string(REPLACE ";" " " _BUILD_THREAD_FLAVORS "${BUILD_THREAD_FLAVORS}") +#configure_file("${CMAKE_SOURCE_DIR}/src/Makefile.in" "${PROJECT_DATA_DIR}/Makefile.modinc" @ONLY) + +# create exec +foreach(build_docker build_source_package fix-tp-loading g1-to-g23 gcode-to-ngc get-git-sha get-version-from-git githelper.sh latency-histogram latency-plot latency-test latency-test-atom linuxcnc_info machinekit torture.py) + file(COPY ${CMAKE_CURRENT_BINARY_DIR}/${tool} + DESTINATION ${PROJECT_BIN_DIR} + FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ + GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) +endforeach() + +# create files for installation +set(PROJECT_SYSCONF_DIR "${INSTALL_SYSCONF_DIR}") +set(PROJECT_LIBEXEC_DIR "${CMAKE_INSTALL_PREFIX}/lib/machinekit") +set(PROJECT_BINARY_DIR "${CMAKE_INSTALL_PREFIX}") +set(PROJECT_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin") +set(PROJECT_DATA_DIR "${CMAKE_INSTALL_PREFIX}/share/machinekit") +set(INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include/machinekit") +set(PROJECT_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") + +set(REALTIME ${PROJECT_BIN_DIR}/realtime) +set(EMC2_BIN_DIR ${PROJECT_BIN_DIR}) +set(EMC2_RTLIB_DIR ${PROJECT_LIBEXEC_DIR}) +set(prefix ${PROJECT_BINARY_DIR}) +set(exec_prefix ${PROJECT_BINARY_DIR}) +set(EMC2_SYSTEM_CONFIG_DIR ${PROJECT_SYSCONF_DIR}/machinekit) +set(EMC2_LIBEXEC_DIR ${PROJECT_LIBEXEC_DIR}) +set(EMC2_TCL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib/tcltk/machinekit") + +set(RUN_IN_PLACE "no") + +configure_file("check-build-vs-configure-sha.in" "check-build-vs-configure-sha.dist" @ONLY) +configure_file("linuxcnc.in" "linuxcnc.dist" @ONLY) +configure_file("linuxcncmkdesktop.in" "linuxcncmkdesktop.dist" @ONLY) + +#configure_file("${CMAKE_SOURCE_DIR}/src/Makefile.in" "Makefile.modinc.dist" @ONLY) + +install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/check-build-vs-configure-sha.dist + DESTINATION bin + RENAME check-build-vs-configure-sha) + +install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/linuxcnc.dist + DESTINATION bin + RENAME linuxcnc) + +install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/linuxcncmkdesktop.dist + DESTINATION bin + RENAME linuxcncmkdesktop) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 000000000..04309366f --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,89 @@ +set(CMAKE_LINK_WHAT_YOU_USE ON) + +# Use DT_RPATH instead of DT_RUNPATH +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--disable-new-dtags") +set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--disable-new-dtags") + +set(CMAKE_C_FLAGS + "${CMAKE_C_FLAGS} -fPIC -fwrapv -fno-strict-overflow -std=gnu99 -fgnu89-inline") + +# jessie quirk +if(RELEASE_NUMBER VERSION_LESS "9") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") +endif() + +# this copies the neeaded header files to the build directory +include(link_headers) + +# copy mank in build directory +#add_custom_command(OUTPUT ${PROJECT_BIN_DIR}/mank +# COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/bin/mank +# ${PROJECT_BIN_DIR}/mank +# DEPENDS ${CMAKE_SOURCE_DIR}/bin/mank) +# +#_install_script(${CMAKE_SOURCE_DIR}/bin/mank) + +# make sure the above commands are run +#add_custom_target(copy_mank ALL DEPENDS ${PROJECT_BIN_DIR}/mank) + +# Note: only headers +add_subdirectory(machinetalk) +add_subdirectory(module_helper) +add_subdirectory(libnml) +add_subdirectory(emc) + +# process python files +#set(_mk_dep ${CMAKE_SOURCE_DIR}/lib/python/machinekit/halfile.py +# ${CMAKE_SOURCE_DIR}/lib/python/machinekit/launcher.py +# ${CMAKE_SOURCE_DIR}/lib/python/machinekit/service.py +# ${CMAKE_SOURCE_DIR}/lib/python/machinekit/nosetests) +# +#set(_py_dep ${CMAKE_SOURCE_DIR}/lib/python/drivers +# ${CMAKE_SOURCE_DIR}/lib/python/gladevcp +# ${CMAKE_SOURCE_DIR}/lib/python/bitfile.py +# ${CMAKE_SOURCE_DIR}/lib/python/bwidget.py +# ${CMAKE_SOURCE_DIR}/lib/python/gladevcp_makepins.py +# ${CMAKE_SOURCE_DIR}/lib/python/hal_glib.py +# ${CMAKE_SOURCE_DIR}/lib/python/linux_event.py +# ${CMAKE_SOURCE_DIR}/lib/python/pyvcp_widgets.py +# ${CMAKE_SOURCE_DIR}/lib/python/servicediscovery.py) +# +#add_custom_target(mk_dep ALL +# COMMAND ${CMAKE_COMMAND} +# -E make_directory ${PROJECT_PYTHON_DIR}/machinekit/protobuf +# COMMAND ${CMAKE_COMMAND} +# -E touch ${PROJECT_PYTHON_DIR}/machinekit/__init__.py +# COMMAND ${CMAKE_COMMAND} +# -E touch ${PROJECT_PYTHON_DIR}/machinekit/protobuf/__init__.py +# COMMAND cp -af ${_mk_dep} ${PROJECT_PYTHON_DIR}/machinekit +# DEPENDS ${_mk_dep}) +# +#add_custom_target(py_deps ALL +# COMMAND cp -af ${_py_dep} ${PROJECT_PYTHON_DIR} +# DEPENDS ${_py_dep}) + +## create setup.py +#configure_file( +# "${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in" +# "${PROJECT_PYTHON_DIR}/setup.py") +# +## install python files +#install(CODE "execute_process( +# COMMAND ${CMAKE_MODULE_PATH}/python_package_helper +# ${Python2_EXECUTABLE} +# ${PROJECT_PYTHON_DIR})") + +# create needed directories +file(MAKE_DIRECTORY ${PROJECT_MAN_DIR}/man1) +file(MAKE_DIRECTORY ${PROJECT_MAN_DIR}/man3) +file(MAKE_DIRECTORY ${PROJECT_MAN_DIR}/man9) +file(MAKE_DIRECTORY ${PROJECT_SYSCONF_DIR}) + +set(_src ${CMAKE_BINARY_DIR}/include) +set(_dst ${CMAKE_INSTALL_PREFIX}/include/machinekit) +# install headers, convert symlinks to regular files +install(CODE "execute_process(COMMAND \ + sh -c \" mkdir -p $DESTDIR${_dst}; \ + tar -chf - -C ${_src} . | tar -xf - -C $DESTDIR${_dst} \ + \")\ + ") diff --git a/src/emc/CMakeLists.txt b/src/emc/CMakeLists.txt new file mode 100644 index 000000000..993336d37 --- /dev/null +++ b/src/emc/CMakeLists.txt @@ -0,0 +1,45 @@ +cmake_minimum_required(VERSION 3.13) +set (project mk) + +add_definitions(-DEMC2_DEFAULT_NMLFILE="${CMAKE_INSTALL_PREFIX}/configs/common/linuxcnc.nml") + +include_directories(../libnml) +include_directories(${Python2_INCLUDE_DIRS}) + +# For libnml +link_directories(${LIBRARY_OUTPUT_DIRECTORY}) + +add_subdirectory(iotask) +add_subdirectory(motion) +add_subdirectory(nml_intf) +add_subdirectory(rs274ngc) +add_subdirectory(tp) +add_subdirectory(task) +add_subdirectory(toolstore) +add_subdirectory(canterp) +add_subdirectory(kinematics) +add_subdirectory(usr_intf) +add_subdirectory(pythonplugin) +add_subdirectory(sai) +add_subdirectory(ini) + +add_library(${project} STATIC + $ + $ + $ +) + +add_library(${project}_SHARED SHARED + $ + $ + $ +) +set_target_properties(${project}_SHARED PROPERTIES OUTPUT_NAME ${project}) + +install(TARGETS ${project} + ARCHIVE DESTINATION lib +) + +install(TARGETS ${project}_SHARED + LIBRARY DESTINATION lib +) diff --git a/src/emc/canterp/CMakeLists.txt b/src/emc/canterp/CMakeLists.txt new file mode 100644 index 000000000..10434d41a --- /dev/null +++ b/src/emc/canterp/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 2.8) +set (project canterp) + +set(${project}_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/canterp.cc +) + +include_directories(../) + +add_library(${project} SHARED ${${project}_SOURCES} ${${project}_HEADERS} ) +target_compile_options(${project} PUBLIC -fPIC) + +install(TARGETS ${project} + LIBRARY DESTINATION lib +) diff --git a/src/emc/canterp/canterp.cc b/src/emc/canterp/canterp.cc index a6dd51a21..2b7ad90cb 100644 --- a/src/emc/canterp/canterp.cc +++ b/src/emc/canterp/canterp.cc @@ -54,11 +54,11 @@ #include // isspace() #include #include -#include "config.h" -#include "emc/nml_intf/interp_return.hh" -#include "emc/nml_intf/canon.hh" -#include "emc/rs274ngc/interp_base.hh" -#include "modal_state.hh" +#include +#include +#include +#include +#include static char the_command[LINELEN] = { 0 }; // our current command static char the_command_name[LINELEN] = { 0 }; // just the name part diff --git a/src/emc/ini/CMakeLists.txt b/src/emc/ini/CMakeLists.txt new file mode 100644 index 000000000..44a3a19f4 --- /dev/null +++ b/src/emc/ini/CMakeLists.txt @@ -0,0 +1,24 @@ +cmake_minimum_required(VERSION 2.8) +set (project ini) + +set(${project}_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/initraj.cc + ${CMAKE_CURRENT_SOURCE_DIR}/iniaxis.cc + ${CMAKE_CURRENT_SOURCE_DIR}/inihal.cc + ${CMAKE_CURRENT_SOURCE_DIR}/initool.cc + ${CMAKE_CURRENT_SOURCE_DIR}/emcIniFile.cc +) + +set(${project}_HEADERS + ${CMAKE_CURRENT_SOURCE_DIR}/iniaxis.hh + ${CMAKE_CURRENT_SOURCE_DIR}/inihal.hh + ${CMAKE_CURRENT_SOURCE_DIR}/initraj.hh + ${CMAKE_CURRENT_SOURCE_DIR}/initool.hh + ${CMAKE_CURRENT_SOURCE_DIR}/emcIniFile.hh +) + +include_directories(../) + +#add_library(${project} ${${project}_SOURCES} ${${project}_HEADERS} ) +add_library(${project} OBJECT ${${project}_SOURCES} ${${project}_HEADERS} ) +target_compile_options(${project} PUBLIC -fPIC) diff --git a/src/emc/ini/emcIniFile.hh b/src/emc/ini/emcIniFile.hh index fb3526c49..be4db2b7e 100644 --- a/src/emc/ini/emcIniFile.hh +++ b/src/emc/ini/emcIniFile.hh @@ -32,7 +32,7 @@ #ifndef _EMCINIFILE_HH_ #define _EMCINIFILE_HH_ -#include "emc.hh" +#include #include "inifile.hh" diff --git a/src/emc/ini/hal.h b/src/emc/ini/hal.h deleted file mode 120000 index 04798acf6..000000000 --- a/src/emc/ini/hal.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/hal.h \ No newline at end of file diff --git a/src/emc/ini/hal_types.h b/src/emc/ini/hal_types.h deleted file mode 120000 index 9caade8cc..000000000 --- a/src/emc/ini/hal_types.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/hal_types.h \ No newline at end of file diff --git a/src/emc/ini/iniaxis.cc b/src/emc/ini/iniaxis.cc index ee0a6d6a2..000d63747 100644 --- a/src/emc/ini/iniaxis.cc +++ b/src/emc/ini/iniaxis.cc @@ -21,12 +21,12 @@ #include #include -#include "emc.hh" -#include "rcs_print.hh" +#include +#include #include "emcIniFile.hh" #include "iniaxis.hh" // these decls -#include "emcglb.h" // EMC_DEBUG -#include "emccfg.h" // default values for globals +#include // EMC_DEBUG +#include // default values for globals #include "inihal.hh" diff --git a/src/emc/ini/iniaxis.hh b/src/emc/ini/iniaxis.hh index 4dcd86f0f..d425fc499 100644 --- a/src/emc/ini/iniaxis.hh +++ b/src/emc/ini/iniaxis.hh @@ -14,7 +14,7 @@ #ifndef INIAXIS_HH #define INIAXIS_HH -#include "emc.hh" // EMC_AXIS_STAT +#include // EMC_AXIS_STAT /* initializes axis modules from ini file */ extern int iniAxis(int axis, const char *filename); diff --git a/src/emc/ini/inihal.cc b/src/emc/ini/inihal.cc index 1a14fd556..6542bd026 100644 --- a/src/emc/ini/inihal.cc +++ b/src/emc/ini/inihal.cc @@ -18,11 +18,11 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------*/ -#include "rcs_print.hh" -#include "emc.hh" +#include +#include #include -#include "hal.h" -#include "rtapi.h" +#include +#include #include "inihal.hh" static int debug=1; diff --git a/src/emc/ini/inihal.hh b/src/emc/ini/inihal.hh index fabaedd5f..5d106c677 100644 --- a/src/emc/ini/inihal.hh +++ b/src/emc/ini/inihal.hh @@ -19,8 +19,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------*/ #ifndef INIHAL_H #define INIHAL_H -#include "hal.h" -#include "emcmotcfg.h" +#include +#include int check_ini_hal_items(); int ini_hal_init(void); diff --git a/src/emc/ini/initool.cc b/src/emc/ini/initool.cc index 29d8c273f..57118410f 100644 --- a/src/emc/ini/initool.cc +++ b/src/emc/ini/initool.cc @@ -17,12 +17,12 @@ #include // atol() #include // strcpy() -#include "emc.hh" -#include "emcpos.h" // EmcPose -#include "rcs_print.hh" +#include +#include // EmcPose +#include #include "inifile.hh" #include "initool.hh" // these decls -#include "emcglb.h" // TOOL_TABLE_FILE +#include // TOOL_TABLE_FILE /* loadTool() diff --git a/src/emc/ini/initraj.cc b/src/emc/ini/initraj.cc index d4bed119c..401926dcf 100644 --- a/src/emc/ini/initraj.cc +++ b/src/emc/ini/initraj.cc @@ -18,13 +18,13 @@ #include // strlen() #include // isspace() -#include "emc.hh" -#include "emcpos.h" // EmcPose -#include "rcs_print.hh" -#include "posemath.h" // PM_POSE, PM_RPY +#include +#include // EmcPose +#include +#include // PM_POSE, PM_RPY #include "emcIniFile.hh" #include "initraj.hh" // these decls -#include "emcglb.h" /*! \todo TRAVERSE_RATE (FIXME) */ +#include /*! \todo TRAVERSE_RATE (FIXME) */ #include "inihal.hh" extern value_inihal_data old_inihal_data; diff --git a/src/emc/ini/rtapi.h b/src/emc/ini/rtapi.h deleted file mode 120000 index 19ace0fa7..000000000 --- a/src/emc/ini/rtapi.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi.h \ No newline at end of file diff --git a/src/emc/ini/rtapi_errno.h b/src/emc/ini/rtapi_errno.h deleted file mode 120000 index a7c499fbe..000000000 --- a/src/emc/ini/rtapi_errno.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_errno.h \ No newline at end of file diff --git a/src/emc/ini/rtapi_exception.h b/src/emc/ini/rtapi_exception.h deleted file mode 120000 index b36191755..000000000 --- a/src/emc/ini/rtapi_exception.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_exception.h \ No newline at end of file diff --git a/src/emc/ini/rtapi_global.h b/src/emc/ini/rtapi_global.h deleted file mode 120000 index 6dd28b7aa..000000000 --- a/src/emc/ini/rtapi_global.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_global.h \ No newline at end of file diff --git a/src/emc/ini/rtapi_heap.h b/src/emc/ini/rtapi_heap.h deleted file mode 120000 index c43e557ad..000000000 --- a/src/emc/ini/rtapi_heap.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_heap.h \ No newline at end of file diff --git a/src/emc/ini/rtapi_heap_private.h b/src/emc/ini/rtapi_heap_private.h deleted file mode 120000 index 09d0c0749..000000000 --- a/src/emc/ini/rtapi_heap_private.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_heap_private.h \ No newline at end of file diff --git a/src/emc/iotask/CMakeLists.txt b/src/emc/iotask/CMakeLists.txt new file mode 100644 index 000000000..8e194580e --- /dev/null +++ b/src/emc/iotask/CMakeLists.txt @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 2.8) +set (project iotask) + +include_directories(../) + +add_executable(io ioControl.cc) +target_link_libraries(io nml mkhal mk) + +install(TARGETS io + RUNTIME DESTINATION bin +) + +add_executable(iov2 ioControl_v2.cc ) +target_link_libraries(iov2 nml mkhal mkini mk) + +install(TARGETS iov2 + RUNTIME DESTINATION bin +) diff --git a/src/emc/iotask/hal.h b/src/emc/iotask/hal.h deleted file mode 120000 index 04798acf6..000000000 --- a/src/emc/iotask/hal.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/hal.h \ No newline at end of file diff --git a/src/emc/iotask/hal_accessor.h b/src/emc/iotask/hal_accessor.h deleted file mode 120000 index b3285a101..000000000 --- a/src/emc/iotask/hal_accessor.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/hal_accessor.h \ No newline at end of file diff --git a/src/emc/iotask/hal_accessor_macros.h b/src/emc/iotask/hal_accessor_macros.h deleted file mode 120000 index d0ab249fa..000000000 --- a/src/emc/iotask/hal_accessor_macros.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/hal_accessor_macros.h \ No newline at end of file diff --git a/src/emc/iotask/hal_list.h b/src/emc/iotask/hal_list.h deleted file mode 120000 index 6343a58af..000000000 --- a/src/emc/iotask/hal_list.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/hal_list.h \ No newline at end of file diff --git a/src/emc/iotask/hal_logging.h b/src/emc/iotask/hal_logging.h deleted file mode 120000 index c78e490ad..000000000 --- a/src/emc/iotask/hal_logging.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/hal_logging.h \ No newline at end of file diff --git a/src/emc/iotask/hal_object.h b/src/emc/iotask/hal_object.h deleted file mode 120000 index 5d6d2dfe0..000000000 --- a/src/emc/iotask/hal_object.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/hal_object.h \ No newline at end of file diff --git a/src/emc/iotask/hal_object_selectors.h b/src/emc/iotask/hal_object_selectors.h deleted file mode 120000 index 36734bdd8..000000000 --- a/src/emc/iotask/hal_object_selectors.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/hal_object_selectors.h \ No newline at end of file diff --git a/src/emc/iotask/hal_priv.h b/src/emc/iotask/hal_priv.h deleted file mode 120000 index 73b4e6800..000000000 --- a/src/emc/iotask/hal_priv.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/hal_priv.h \ No newline at end of file diff --git a/src/emc/iotask/hal_types.h b/src/emc/iotask/hal_types.h deleted file mode 120000 index 9caade8cc..000000000 --- a/src/emc/iotask/hal_types.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/hal_types.h \ No newline at end of file diff --git a/src/emc/iotask/ioControl.cc b/src/emc/iotask/ioControl.cc index 1bbdafd66..a399af74f 100644 --- a/src/emc/iotask/ioControl.cc +++ b/src/emc/iotask/ioControl.cc @@ -72,18 +72,18 @@ #include #include -#include "hal.h" /* access to HAL functions/definitions */ -#include "rtapi.h" /* rtapi_print_msg */ -#include "rcs.hh" /* RCS_CMD_CHANNEL */ -#include "emc.hh" /* EMC NML */ -#include "emc_nml.hh" -#include "emcglb.h" /* EMC_NMLFILE, EMC_INIFILE, TOOL_TABLE_FILE */ -#include "inifile.hh" /* INIFILE */ -#include "initool.hh" /* iniTool() */ -#include "nml_oi.hh" -#include "timer.hh" -#include "rcs_print.hh" -#include "tool_parse.h" +#include /* access to HAL functions/definitions */ +#include /* rtapi_print_msg */ +#include /* RCS_CMD_CHANNEL */ +#include /* EMC NML */ +#include +#include /* EMC_NMLFILE, EMC_INIFILE, TOOL_TABLE_FILE */ +#include /* INIFILE */ +#include /* iniTool() */ +#include +#include +#include +#include static RCS_CMD_CHANNEL *emcioCommandBuffer = 0; static RCS_CMD_MSG *emcioCommand = 0; diff --git a/src/emc/iotask/ioControl_v2.cc b/src/emc/iotask/ioControl_v2.cc index 14ab0c25d..6fe2052d9 100644 --- a/src/emc/iotask/ioControl_v2.cc +++ b/src/emc/iotask/ioControl_v2.cc @@ -58,18 +58,18 @@ #include #include -#include "hal.h" /* access to HAL functions/definitions */ -#include "rtapi.h" /* rtapi_print_msg */ -#include "rcs.hh" /* RCS_CMD_CHANNEL */ -#include "emc.hh" /* EMC NML */ -#include "emc_nml.hh" -#include "emcglb.h" /* EMC_NMLFILE, EMC_INIFILE, TOOL_TABLE_FILE */ -#include "inifile.hh" /* INIFILE */ -#include "initool.hh" /* iniTool() */ -#include "nml_oi.hh" -#include "timer.hh" -#include "rcs_print.hh" -#include "tool_parse.h" +#include /* access to HAL functions/definitions */ +#include /* rtapi_print_msg */ +#include /* RCS_CMD_CHANNEL */ +#include /* EMC NML */ +#include +#include /* EMC_NMLFILE, EMC_INIFILE, TOOL_TABLE_FILE */ +#include /* INIFILE */ +#include /* iniTool() */ +#include +#include +#include +#include static RCS_CMD_CHANNEL *emcioCommandBuffer = 0; static RCS_CMD_MSG *emcioCommand = 0; diff --git a/src/emc/iotask/rtapi.h b/src/emc/iotask/rtapi.h deleted file mode 120000 index 19ace0fa7..000000000 --- a/src/emc/iotask/rtapi.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi.h \ No newline at end of file diff --git a/src/emc/iotask/rtapi_errno.h b/src/emc/iotask/rtapi_errno.h deleted file mode 120000 index a7c499fbe..000000000 --- a/src/emc/iotask/rtapi_errno.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_errno.h \ No newline at end of file diff --git a/src/emc/iotask/rtapi_exception.h b/src/emc/iotask/rtapi_exception.h deleted file mode 120000 index b36191755..000000000 --- a/src/emc/iotask/rtapi_exception.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_exception.h \ No newline at end of file diff --git a/src/emc/iotask/rtapi_global.h b/src/emc/iotask/rtapi_global.h deleted file mode 120000 index 6dd28b7aa..000000000 --- a/src/emc/iotask/rtapi_global.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_global.h \ No newline at end of file diff --git a/src/emc/iotask/rtapi_heap.h b/src/emc/iotask/rtapi_heap.h deleted file mode 120000 index c43e557ad..000000000 --- a/src/emc/iotask/rtapi_heap.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_heap.h \ No newline at end of file diff --git a/src/emc/iotask/rtapi_heap_private.h b/src/emc/iotask/rtapi_heap_private.h deleted file mode 120000 index 09d0c0749..000000000 --- a/src/emc/iotask/rtapi_heap_private.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_heap_private.h \ No newline at end of file diff --git a/src/emc/kinematics/5axiskins.c b/src/emc/kinematics/5axiskins.c index d40671546..55be22b54 100644 --- a/src/emc/kinematics/5axiskins.c +++ b/src/emc/kinematics/5axiskins.c @@ -13,13 +13,13 @@ * Last change: ********************************************************************/ -#include "rtapi.h" /* RTAPI realtime OS API */ -#include "rtapi_app.h" /* RTAPI realtime module decls */ -#include "rtapi_math.h" +#include /* RTAPI realtime OS API */ +#include /* RTAPI realtime module decls */ +#include #include "kinematics.h" -#include "posemath.h" -#include "hal.h" +#include +#include #define d2r(d) ((d)*PM_PI/180.0) #define r2d(r) ((r)*180.0/PM_PI) diff --git a/src/emc/kinematics/CMakeLists.txt b/src/emc/kinematics/CMakeLists.txt new file mode 100644 index 000000000..7bc874d38 --- /dev/null +++ b/src/emc/kinematics/CMakeLists.txt @@ -0,0 +1,86 @@ +cmake_minimum_required(VERSION 2.8) +set (project kinematics) + +set(USER_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/genserkins.c + ${CMAKE_CURRENT_SOURCE_DIR}/drawbotkins.c +) + +set(PY_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/lineardeltakins.c +) + +set(${project}_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/tripodkins.c + ${CMAKE_CURRENT_SOURCE_DIR}/rotatekins.c + ${CMAKE_CURRENT_SOURCE_DIR}/XYZACkins.c + ${CMAKE_CURRENT_SOURCE_DIR}/genhexkins.c + ${CMAKE_CURRENT_SOURCE_DIR}/5axiskins.c + ${CMAKE_CURRENT_SOURCE_DIR}/maxkins.c + ${CMAKE_CURRENT_SOURCE_DIR}/cubic.c + ${CMAKE_CURRENT_SOURCE_DIR}/scarakins.c + ${CMAKE_CURRENT_SOURCE_DIR}/trivkins.c + ${CMAKE_CURRENT_SOURCE_DIR}/gantrykins.c + ${CMAKE_CURRENT_SOURCE_DIR}/pumakins.c +) + +set(${project}_HEADERS + ${CMAKE_CURRENT_SOURCE_DIR}/rtai-kernel.h + ${CMAKE_CURRENT_SOURCE_DIR}/genserkins.h + ${CMAKE_CURRENT_SOURCE_DIR}/pumakins.h + ${CMAKE_CURRENT_SOURCE_DIR}/genhexkins.h + ${CMAKE_CURRENT_SOURCE_DIR}/kinematics.h + ${CMAKE_CURRENT_SOURCE_DIR}/rt-preempt.h + ${CMAKE_CURRENT_SOURCE_DIR}/lineardeltakins-common.h + ${CMAKE_CURRENT_SOURCE_DIR}/cubic.h +) + +add_subdirectory(userpci) + +include_directories(../) + +#add_library(${project} OBJECT ${${project}_SOURCES} ${${project}_HEADERS} ) +#target_compile_options(${project} PUBLIC) + +## -- DELTA_MODULE + +set(DELTA_MODULE_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/lineardeltakins.cc +) + +add_library(lineardeltakins SHARED ${DELTA_MODULE_SOURCES} ) +target_link_libraries(lineardeltakins mkhal rtapi_math Boost::python27) +target_compile_options(lineardeltakins PUBLIC -x c++ -Wno-declaration-after-statement -fpermissive ) +set_target_properties(lineardeltakins PROPERTIES PREFIX "") + +install( + TARGETS lineardeltakins + DESTINATION ${Python2_SITELIB} +) + +## -- GEN_SERKINS + +set(GEN_SERKINS_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/genserkins.c +) + +add_executable(genserkins ${GEN_SERKINS_SOURCES}) +target_link_libraries(genserkins mkhal posemath rtapi_math) + +install( + TARGETS genserkins + RUNTIME DESTINATION bin +) + +## -- DRAW_BOTKINS + +set(DRAW_BOTKINS_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/drawbotkins.c +) +add_executable(drawbotkins ${GEN_SERKINS_SOURCES}) +target_link_libraries(drawbotkins mkhal posemath rtapi_math) + +install( + TARGETS drawbotkins + RUNTIME DESTINATION bin +) diff --git a/src/emc/kinematics/XYZACkins.c b/src/emc/kinematics/XYZACkins.c index 34cf9212a..88451e3a3 100644 --- a/src/emc/kinematics/XYZACkins.c +++ b/src/emc/kinematics/XYZACkins.c @@ -10,10 +10,10 @@ * ********************************************************************/ #include "kinematics.h" /* these decls */ -#include "posemath.h" -#include "hal.h" -#include "rtapi.h" -#include "rtapi_math.h" +#include +#include +#include +#include #define VTVERSION VTKINEMATICS_VERSION1 diff --git a/src/emc/kinematics/cubic.c b/src/emc/kinematics/cubic.c index 04a268ea3..9bafdc77a 100644 --- a/src/emc/kinematics/cubic.c +++ b/src/emc/kinematics/cubic.c @@ -15,9 +15,9 @@ * * Last change: ********************************************************************/ -#include "posemath.h" +#include #include "cubic.h" -#include "rtapi_math.h" +#include #define SEGMENT_TIME_SET 0x01 #define INTERPOLATION_RATE_SET 0x02 diff --git a/src/emc/kinematics/drawbotkins.c b/src/emc/kinematics/drawbotkins.c index 865bc3eb0..ac46ebbc0 100644 --- a/src/emc/kinematics/drawbotkins.c +++ b/src/emc/kinematics/drawbotkins.c @@ -23,11 +23,11 @@ #include #include "kinematics.h" -#include "rtapi.h" -#include "rtapi_app.h" -#include "rtapi_math.h" -#include "posemath.h" -#include "hal.h" +#include +#include +#include +#include +#include #define VTVERSION VTKINEMATICS_VERSION1 diff --git a/src/emc/kinematics/gantrykins.c b/src/emc/kinematics/gantrykins.c index a983cf736..9c4f82abe 100644 --- a/src/emc/kinematics/gantrykins.c +++ b/src/emc/kinematics/gantrykins.c @@ -10,12 +10,12 @@ * ********************************************************************/ -#include "motion.h" /* these decls */ -#include "hal.h" -#include "rtapi.h" -#include "rtapi_math.h" -#include "rtapi_string.h" -#include "rtapi_app.h" /* RTAPI realtime module decls */ +#include /* these decls */ +#include +#include +#include +#include +#include /* RTAPI realtime module decls */ struct data { hal_s32_t joints[EMCMOT_MAX_JOINTS]; diff --git a/src/emc/kinematics/genhexkins.c b/src/emc/kinematics/genhexkins.c index dee7a148f..09514cd09 100644 --- a/src/emc/kinematics/genhexkins.c +++ b/src/emc/kinematics/genhexkins.c @@ -49,8 +49,8 @@ out of the multiple possible solutions. -----------------------------------------------------------------------------*/ -#include "rtapi_math.h" -#include "posemath.h" +#include +#include #include "genhexkins.h" #include "kinematics.h" /* these decls, KINEMATICS_FORWARD_FLAGS */ diff --git a/src/emc/kinematics/genhexkins.h b/src/emc/kinematics/genhexkins.h index dce1a59e0..1b553f162 100644 --- a/src/emc/kinematics/genhexkins.h +++ b/src/emc/kinematics/genhexkins.h @@ -24,7 +24,7 @@ */ -#include "posemath.h" /* PmCartesian */ +#include /* PmCartesian */ /* genhexSetParams lets you set the Cartesian coords of the base and platform, overriding the defaults set in the subsequent #defines */ diff --git a/src/emc/kinematics/genserkins.c b/src/emc/kinematics/genserkins.c index e657776ca..ab69f8b73 100644 --- a/src/emc/kinematics/genserkins.c +++ b/src/emc/kinematics/genserkins.c @@ -31,18 +31,18 @@ * add HAL pins for ULAPI compiled version */ -#include "rtapi_math.h" -#include "gotypes.h" /* go_result, go_integer */ -#include "gomath.h" /* go_pose */ +#include +#include /* go_result, go_integer */ +#include /* go_pose */ #include "genserkins.h" /* these decls */ #include "kinematics.h" #ifdef RTAPI -#include "rtapi.h" -#include "rtapi_app.h" +#include +#include #endif -#include "hal.h" +#include struct haldata { hal_float_t *a[GENSER_MAX_JOINTS]; hal_float_t *alpha[GENSER_MAX_JOINTS]; diff --git a/src/emc/kinematics/genserkins.h b/src/emc/kinematics/genserkins.h index 31d1d6746..8dd833941 100644 --- a/src/emc/kinematics/genserkins.h +++ b/src/emc/kinematics/genserkins.h @@ -33,8 +33,8 @@ #ifndef GENSERKINS_H #define GENSERKINS_H -#include "gomath.h" /* go_pose */ -#include "hal.h" /* HAL data types */ +#include /* go_pose */ +#include /* HAL data types */ /*! The maximum number of joints supported by the general serial diff --git a/src/emc/kinematics/hal.h b/src/emc/kinematics/hal.h deleted file mode 120000 index 04798acf6..000000000 --- a/src/emc/kinematics/hal.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/hal.h \ No newline at end of file diff --git a/src/emc/kinematics/hal_types.h b/src/emc/kinematics/hal_types.h deleted file mode 120000 index 9caade8cc..000000000 --- a/src/emc/kinematics/hal_types.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/hal_types.h \ No newline at end of file diff --git a/src/emc/kinematics/kinematics.h b/src/emc/kinematics/kinematics.h index 0f5996859..f428b1568 100644 --- a/src/emc/kinematics/kinematics.h +++ b/src/emc/kinematics/kinematics.h @@ -15,8 +15,8 @@ #ifndef KINEMATICS_H #define KINEMATICS_H -#include "emcpos.h" /* EmcPose */ -#include "vtable.h" // vtable signatures +#include /* EmcPose */ +#include // vtable signatures /* The type of kinematics used. diff --git a/src/emc/kinematics/lineardeltakins-common.h b/src/emc/kinematics/lineardeltakins-common.h index d3093538e..fa5cbbda4 100644 --- a/src/emc/kinematics/lineardeltakins-common.h +++ b/src/emc/kinematics/lineardeltakins-common.h @@ -32,8 +32,8 @@ // common routines used by the userspace kinematics and the realtime kinematics // user must include a math.h-type header first // Inspired by Marlin delta firmware and https://gist.github.com/kastner/5279172 -#include "emcpos.h" -#include "rtapi_math.h" +#include +#include static double L, R, J0off, J1off, J2off; static double Ax, Ay, Bx, By, Cx, Cy, L2; diff --git a/src/emc/kinematics/lineardeltakins.c b/src/emc/kinematics/lineardeltakins.c index 9969e1c4e..e073e82a8 100644 --- a/src/emc/kinematics/lineardeltakins.c +++ b/src/emc/kinematics/lineardeltakins.c @@ -14,10 +14,10 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -#include "hal.h" +#include #include "kinematics.h" -#include "rtapi_math.h" -#include "rtapi_app.h" +#include +#include #include "lineardeltakins-common.h" #define VTVERSION VTKINEMATICS_VERSION1 diff --git a/src/emc/kinematics/maxkins.c b/src/emc/kinematics/maxkins.c index 4e0de7932..d4e8bc0b4 100644 --- a/src/emc/kinematics/maxkins.c +++ b/src/emc/kinematics/maxkins.c @@ -11,13 +11,13 @@ ********************************************************************/ #include "kinematics.h" /* these decls */ -#include "posemath.h" -#include "hal.h" -#include "rtapi.h" -#include "rtapi_math.h" +#include +#include +#include +#include -#include "rtapi.h" /* RTAPI realtime OS API */ -#include "rtapi_app.h" /* RTAPI realtime module decls */ +#include /* RTAPI realtime OS API */ +#include /* RTAPI realtime module decls */ #define d2r(d) ((d)*PM_PI/180.0) diff --git a/src/emc/kinematics/pumakins.c b/src/emc/kinematics/pumakins.c index d4a1a1a0c..1a60e45a9 100644 --- a/src/emc/kinematics/pumakins.c +++ b/src/emc/kinematics/pumakins.c @@ -15,14 +15,14 @@ ******************************************************************* */ -#include "rtapi_math.h" -#include "posemath.h" +#include +#include #include "pumakins.h" #include "kinematics.h" /* decls for kinematicsForward, etc. */ -#include "rtapi.h" /* RTAPI realtime OS API */ -#include "rtapi_app.h" /* RTAPI realtime module decls */ -#include "hal.h" +#include /* RTAPI realtime OS API */ +#include /* RTAPI realtime module decls */ +#include #define VTVERSION VTKINEMATICS_VERSION1 diff --git a/src/emc/kinematics/rotatekins.c b/src/emc/kinematics/rotatekins.c index 8e28d8b0a..a69ce0260 100644 --- a/src/emc/kinematics/rotatekins.c +++ b/src/emc/kinematics/rotatekins.c @@ -12,11 +12,11 @@ * ********************************************************************/ -#include "rtapi_math.h" +#include #include "kinematics.h" /* these decls */ -#include "rtapi.h" /* RTAPI realtime OS API */ -#include "rtapi_app.h" /* RTAPI realtime module decls */ -#include "hal.h" +#include /* RTAPI realtime OS API */ +#include /* RTAPI realtime module decls */ +#include #define VTVERSION VTKINEMATICS_VERSION1 diff --git a/src/emc/kinematics/rt-preempt.h b/src/emc/kinematics/rt-preempt.h index 7d9ef6cb3..3891e9da3 100644 --- a/src/emc/kinematics/rt-preempt.h +++ b/src/emc/kinematics/rt-preempt.h @@ -28,7 +28,7 @@ * TASK FUNCTIONS * ************************************************************************/ -#include "config.h" +#include #include // sched_get_priority_*() #include /* pthread_* */ diff --git a/src/emc/kinematics/rtapi.h b/src/emc/kinematics/rtapi.h deleted file mode 120000 index 19ace0fa7..000000000 --- a/src/emc/kinematics/rtapi.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi.h \ No newline at end of file diff --git a/src/emc/kinematics/rtapi_app.h b/src/emc/kinematics/rtapi_app.h deleted file mode 120000 index 44c07b6c3..000000000 --- a/src/emc/kinematics/rtapi_app.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_app.h \ No newline at end of file diff --git a/src/emc/kinematics/rtapi_atomics.h b/src/emc/kinematics/rtapi_atomics.h deleted file mode 120000 index 8b6c87e4a..000000000 --- a/src/emc/kinematics/rtapi_atomics.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_atomics.h \ No newline at end of file diff --git a/src/emc/kinematics/rtapi_bitops.h b/src/emc/kinematics/rtapi_bitops.h deleted file mode 120000 index 00d1f6b4f..000000000 --- a/src/emc/kinematics/rtapi_bitops.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_bitops.h \ No newline at end of file diff --git a/src/emc/kinematics/rtapi_byteorder.h b/src/emc/kinematics/rtapi_byteorder.h deleted file mode 120000 index b0c151b4f..000000000 --- a/src/emc/kinematics/rtapi_byteorder.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_byteorder.h \ No newline at end of file diff --git a/src/emc/kinematics/rtapi_common.h b/src/emc/kinematics/rtapi_common.h deleted file mode 120000 index 568224652..000000000 --- a/src/emc/kinematics/rtapi_common.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_common.h \ No newline at end of file diff --git a/src/emc/kinematics/rtapi_compat.h b/src/emc/kinematics/rtapi_compat.h deleted file mode 120000 index 83433e978..000000000 --- a/src/emc/kinematics/rtapi_compat.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_compat.h \ No newline at end of file diff --git a/src/emc/kinematics/rtapi_ctype.h b/src/emc/kinematics/rtapi_ctype.h deleted file mode 120000 index 9a6c9a457..000000000 --- a/src/emc/kinematics/rtapi_ctype.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_ctype.h \ No newline at end of file diff --git a/src/emc/kinematics/rtapi_errno.h b/src/emc/kinematics/rtapi_errno.h deleted file mode 120000 index a7c499fbe..000000000 --- a/src/emc/kinematics/rtapi_errno.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_errno.h \ No newline at end of file diff --git a/src/emc/kinematics/rtapi_exception.h b/src/emc/kinematics/rtapi_exception.h deleted file mode 120000 index b36191755..000000000 --- a/src/emc/kinematics/rtapi_exception.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_exception.h \ No newline at end of file diff --git a/src/emc/kinematics/rtapi_export.h b/src/emc/kinematics/rtapi_export.h deleted file mode 120000 index ad469aad1..000000000 --- a/src/emc/kinematics/rtapi_export.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_export.h \ No newline at end of file diff --git a/src/emc/kinematics/rtapi_global.h b/src/emc/kinematics/rtapi_global.h deleted file mode 120000 index 6dd28b7aa..000000000 --- a/src/emc/kinematics/rtapi_global.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_global.h \ No newline at end of file diff --git a/src/emc/kinematics/rtapi_heap.h b/src/emc/kinematics/rtapi_heap.h deleted file mode 120000 index c43e557ad..000000000 --- a/src/emc/kinematics/rtapi_heap.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_heap.h \ No newline at end of file diff --git a/src/emc/kinematics/rtapi_heap_private.h b/src/emc/kinematics/rtapi_heap_private.h deleted file mode 120000 index 09d0c0749..000000000 --- a/src/emc/kinematics/rtapi_heap_private.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_heap_private.h \ No newline at end of file diff --git a/src/emc/kinematics/rtapi_hexdump.h b/src/emc/kinematics/rtapi_hexdump.h deleted file mode 120000 index b03c486d6..000000000 --- a/src/emc/kinematics/rtapi_hexdump.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_hexdump.h \ No newline at end of file diff --git a/src/emc/kinematics/rtapi_int.h b/src/emc/kinematics/rtapi_int.h deleted file mode 120000 index 600140bac..000000000 --- a/src/emc/kinematics/rtapi_int.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_int.h \ No newline at end of file diff --git a/src/emc/kinematics/rtapi_io.h b/src/emc/kinematics/rtapi_io.h deleted file mode 120000 index 2c4a3136a..000000000 --- a/src/emc/kinematics/rtapi_io.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_io.h \ No newline at end of file diff --git a/src/emc/kinematics/rtapi_kdetect.h b/src/emc/kinematics/rtapi_kdetect.h deleted file mode 120000 index 93f2ccbb1..000000000 --- a/src/emc/kinematics/rtapi_kdetect.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_kdetect.h \ No newline at end of file diff --git a/src/emc/kinematics/rtapi_limits.h b/src/emc/kinematics/rtapi_limits.h deleted file mode 120000 index d08ccf37e..000000000 --- a/src/emc/kinematics/rtapi_limits.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_limits.h \ No newline at end of file diff --git a/src/emc/kinematics/rtapi_math.h b/src/emc/kinematics/rtapi_math.h deleted file mode 120000 index cdb837d6c..000000000 --- a/src/emc/kinematics/rtapi_math.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_math.h \ No newline at end of file diff --git a/src/emc/kinematics/rtapi_math64.h b/src/emc/kinematics/rtapi_math64.h deleted file mode 120000 index 63606aa2d..000000000 --- a/src/emc/kinematics/rtapi_math64.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_math64.h \ No newline at end of file diff --git a/src/emc/kinematics/rtapi_mbarrier.h b/src/emc/kinematics/rtapi_mbarrier.h deleted file mode 120000 index cceb593e2..000000000 --- a/src/emc/kinematics/rtapi_mbarrier.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_mbarrier.h \ No newline at end of file diff --git a/src/emc/kinematics/rtapi_proc.h b/src/emc/kinematics/rtapi_proc.h deleted file mode 120000 index 49e195bbb..000000000 --- a/src/emc/kinematics/rtapi_proc.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_proc.h \ No newline at end of file diff --git a/src/emc/kinematics/rtapi_shmkeys.h b/src/emc/kinematics/rtapi_shmkeys.h deleted file mode 120000 index 1d2b226df..000000000 --- a/src/emc/kinematics/rtapi_shmkeys.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_shmkeys.h \ No newline at end of file diff --git a/src/emc/kinematics/rtapi_string.h b/src/emc/kinematics/rtapi_string.h deleted file mode 120000 index 7724188d2..000000000 --- a/src/emc/kinematics/rtapi_string.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_string.h \ No newline at end of file diff --git a/src/emc/kinematics/scarakins.c b/src/emc/kinematics/scarakins.c index 378e96464..27fe43c28 100644 --- a/src/emc/kinematics/scarakins.c +++ b/src/emc/kinematics/scarakins.c @@ -15,13 +15,13 @@ ******************************************************************* */ -#include "posemath.h" -#include "rtapi_math.h" +#include +#include #include "kinematics.h" /* decls for kinematicsForward, etc. */ -#include "rtapi.h" /* RTAPI realtime OS API */ -#include "rtapi_app.h" /* RTAPI realtime module decls */ -#include "hal.h" +#include /* RTAPI realtime OS API */ +#include /* RTAPI realtime module decls */ +#include #define VTVERSION VTKINEMATICS_VERSION1 diff --git a/src/emc/kinematics/tripodkins.c b/src/emc/kinematics/tripodkins.c index 92a8213b4..338e59192 100644 --- a/src/emc/kinematics/tripodkins.c +++ b/src/emc/kinematics/tripodkins.c @@ -63,7 +63,7 @@ */ #include "kinematics.h" /* these decls */ -#include "rtapi_math.h" +#include #define VTVERSION VTKINEMATICS_VERSION1 @@ -346,9 +346,9 @@ int main(int argc, char *argv[]) #endif /* MAIN */ -#include "rtapi.h" /* RTAPI realtime OS API */ -#include "rtapi_app.h" /* RTAPI realtime module decls */ -#include "hal.h" +#include /* RTAPI realtime OS API */ +#include /* RTAPI realtime module decls */ +#include static vtkins_t vtk = { .kinematicsForward = kinematicsForward, diff --git a/src/emc/kinematics/trivkins.c b/src/emc/kinematics/trivkins.c index dbff100f3..79716302d 100644 --- a/src/emc/kinematics/trivkins.c +++ b/src/emc/kinematics/trivkins.c @@ -15,9 +15,9 @@ #include "kinematics.h" /* these decls */ -#include "rtapi.h" /* RTAPI realtime OS API */ -#include "rtapi_app.h" /* RTAPI realtime module decls */ -#include "hal.h" +#include /* RTAPI realtime OS API */ +#include /* RTAPI realtime module decls */ +#include #define VTVERSION VTKINEMATICS_VERSION1 diff --git a/src/emc/kinematics/userpci/CMakeLists.txt b/src/emc/kinematics/userpci/CMakeLists.txt new file mode 100644 index 000000000..2273afa64 --- /dev/null +++ b/src/emc/kinematics/userpci/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 2.8) +set (project userpci) + +set(${project}_HEADERS + ${CMAKE_CURRENT_SOURCE_DIR}/module.h + ${CMAKE_CURRENT_SOURCE_DIR}/slab.h + ${CMAKE_CURRENT_SOURCE_DIR}/string.h + ${CMAKE_CURRENT_SOURCE_DIR}/gfp.h + ${CMAKE_CURRENT_SOURCE_DIR}/rtapi_pci.h + ${CMAKE_CURRENT_SOURCE_DIR}/firmware.h + ${CMAKE_CURRENT_SOURCE_DIR}/list.h + ${CMAKE_CURRENT_SOURCE_DIR}/device.h + ${CMAKE_CURRENT_SOURCE_DIR}/config_module.h +) + +#add_library(${project} STATIC ${${project}_HEADERS} ) diff --git a/src/emc/kinematics/vtable.h b/src/emc/kinematics/vtable.h deleted file mode 120000 index 8733133c0..000000000 --- a/src/emc/kinematics/vtable.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/vtable.h \ No newline at end of file diff --git a/src/emc/motion/CMakeLists.txt b/src/emc/motion/CMakeLists.txt new file mode 100644 index 000000000..2f4e2de64 --- /dev/null +++ b/src/emc/motion/CMakeLists.txt @@ -0,0 +1,37 @@ +cmake_minimum_required(VERSION 2.8) +set (project motion) + +set(${project}_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/homing.c + ${CMAKE_CURRENT_SOURCE_DIR}/stashf.c + ${CMAKE_CURRENT_SOURCE_DIR}/command.c + ${CMAKE_CURRENT_SOURCE_DIR}/simple_tp.c + ${CMAKE_CURRENT_SOURCE_DIR}/emcmotglb.c + ${CMAKE_CURRENT_SOURCE_DIR}/motion.c + ${CMAKE_CURRENT_SOURCE_DIR}/dbuf.c + ${CMAKE_CURRENT_SOURCE_DIR}/control.c + ${CMAKE_CURRENT_SOURCE_DIR}/emcmotutil.c + ${CMAKE_CURRENT_SOURCE_DIR}/usrmotintf.cc +) + +set(${project}_HEADERS + ${CMAKE_CURRENT_SOURCE_DIR}/motion_debug.h + ${CMAKE_CURRENT_SOURCE_DIR}/motion_id.h + ${CMAKE_CURRENT_SOURCE_DIR}/motion_struct.h + ${CMAKE_CURRENT_SOURCE_DIR}/emcmotglb.h + ${CMAKE_CURRENT_SOURCE_DIR}/emcmotcfg.h + ${CMAKE_CURRENT_SOURCE_DIR}/usrmotintf.h + ${CMAKE_CURRENT_SOURCE_DIR}/state_tag.h + ${CMAKE_CURRENT_SOURCE_DIR}/simple_tp.h + ${CMAKE_CURRENT_SOURCE_DIR}/stashf_wrap.h + ${CMAKE_CURRENT_SOURCE_DIR}/motion.h + ${CMAKE_CURRENT_SOURCE_DIR}/mot_priv.h + ${CMAKE_CURRENT_SOURCE_DIR}/dbuf.h + ${CMAKE_CURRENT_SOURCE_DIR}/stashf.h +) + +include_directories(../) +include_directories(${KERNELHEADERS_INCLUDE_DIRS}) + +#add_library(${project} OBJECT ${${project}_SOURCES} ${${project}_HEADERS} ) +#target_compile_options(${project} PUBLIC) diff --git a/src/emc/motion/command.c b/src/emc/motion/command.c index 7b72e38f0..c3601d63f 100644 --- a/src/emc/motion/command.c +++ b/src/emc/motion/command.c @@ -57,21 +57,23 @@ * ********************************************************************/ +#ifndef _LINUX_TYPES_H #include +#endif #include -#include "posemath.h" -#include "rtapi.h" -#include "hal.h" -#include "hal_priv.h" +#include +#include +#include +#include #include "motion.h" #include "motion_debug.h" #include "motion_struct.h" #include "emcmotglb.h" #include "mot_priv.h" -#include "rtapi_math.h" -#include "motion_types.h" +#include +#include -#include "tp_debug.h" +#include // Mark strings for translation, but defer translation to userspace #define _(s) (s) diff --git a/src/emc/motion/hal.h b/src/emc/motion/hal.h deleted file mode 120000 index 04798acf6..000000000 --- a/src/emc/motion/hal.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/hal.h \ No newline at end of file diff --git a/src/emc/motion/hal_accessor.h b/src/emc/motion/hal_accessor.h deleted file mode 120000 index b3285a101..000000000 --- a/src/emc/motion/hal_accessor.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/hal_accessor.h \ No newline at end of file diff --git a/src/emc/motion/hal_accessor_macros.h b/src/emc/motion/hal_accessor_macros.h deleted file mode 120000 index d0ab249fa..000000000 --- a/src/emc/motion/hal_accessor_macros.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/hal_accessor_macros.h \ No newline at end of file diff --git a/src/emc/motion/hal_group.h b/src/emc/motion/hal_group.h deleted file mode 120000 index d0a12c7f3..000000000 --- a/src/emc/motion/hal_group.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/hal_group.h \ No newline at end of file diff --git a/src/emc/motion/hal_internal.h b/src/emc/motion/hal_internal.h deleted file mode 120000 index 1c71a2ed6..000000000 --- a/src/emc/motion/hal_internal.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/hal_internal.h \ No newline at end of file diff --git a/src/emc/motion/hal_iter.h b/src/emc/motion/hal_iter.h deleted file mode 120000 index 60ab4aedb..000000000 --- a/src/emc/motion/hal_iter.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/hal_iter.h \ No newline at end of file diff --git a/src/emc/motion/hal_list.h b/src/emc/motion/hal_list.h deleted file mode 120000 index 6343a58af..000000000 --- a/src/emc/motion/hal_list.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/hal_list.h \ No newline at end of file diff --git a/src/emc/motion/hal_logging.h b/src/emc/motion/hal_logging.h deleted file mode 120000 index c78e490ad..000000000 --- a/src/emc/motion/hal_logging.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/hal_logging.h \ No newline at end of file diff --git a/src/emc/motion/hal_object.h b/src/emc/motion/hal_object.h deleted file mode 120000 index 5d6d2dfe0..000000000 --- a/src/emc/motion/hal_object.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/hal_object.h \ No newline at end of file diff --git a/src/emc/motion/hal_object_selectors.h b/src/emc/motion/hal_object_selectors.h deleted file mode 120000 index 36734bdd8..000000000 --- a/src/emc/motion/hal_object_selectors.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/hal_object_selectors.h \ No newline at end of file diff --git a/src/emc/motion/hal_priv.h b/src/emc/motion/hal_priv.h deleted file mode 120000 index 73b4e6800..000000000 --- a/src/emc/motion/hal_priv.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/hal_priv.h \ No newline at end of file diff --git a/src/emc/motion/hal_rcomp.h b/src/emc/motion/hal_rcomp.h deleted file mode 120000 index 7067a8388..000000000 --- a/src/emc/motion/hal_rcomp.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/hal_rcomp.h \ No newline at end of file diff --git a/src/emc/motion/hal_ring.h b/src/emc/motion/hal_ring.h deleted file mode 120000 index e4b2c0a2f..000000000 --- a/src/emc/motion/hal_ring.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/hal_ring.h \ No newline at end of file diff --git a/src/emc/motion/hal_types.h b/src/emc/motion/hal_types.h deleted file mode 120000 index 9caade8cc..000000000 --- a/src/emc/motion/hal_types.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/hal_types.h \ No newline at end of file diff --git a/src/emc/motion/homing.c b/src/emc/motion/homing.c index cb9f0aa85..d2e9f8fce 100644 --- a/src/emc/motion/homing.c +++ b/src/emc/motion/homing.c @@ -11,11 +11,11 @@ * Copyright (c) 2004 All rights reserved. ********************************************************************/ -#include "rtapi.h" -#include "hal.h" +//#include +//#include #include "motion.h" #include "mot_priv.h" -#include "rtapi_math.h" +#include // Mark strings for translation, but defer translation to userspace #define _(s) (s) diff --git a/src/emc/motion/mot_priv.h b/src/emc/motion/mot_priv.h index e569aa04e..246c37739 100644 --- a/src/emc/motion/mot_priv.h +++ b/src/emc/motion/mot_priv.h @@ -14,7 +14,7 @@ #ifndef MOT_PRIV_H #define MOT_PRIV_H -#include "tp.h" // since we're referencing TP_STRUCT here +#include // since we're referencing TP_STRUCT here /*********************************************************************** * TYPEDEFS, ENUMS, ETC. * @@ -32,8 +32,8 @@ */ /* joint data */ -#include "hal.h" -#include "hal_priv.h" +//#include +#include #include "../motion/motion.h" typedef struct { diff --git a/src/emc/motion/motion.c b/src/emc/motion/motion.c index 9f07eac6d..51620e99f 100644 --- a/src/emc/motion/motion.c +++ b/src/emc/motion/motion.c @@ -10,16 +10,20 @@ ********************************************************************/ #include -#include "rtapi.h" /* RTAPI realtime OS API */ -#include "rtapi_app.h" /* RTAPI realtime module decls */ -#include "rtapi_string.h" /* memset */ -#include "hal.h" /* decls for HAL implementation */ +#include /* RTAPI realtime OS API */ +#include /* RTAPI realtime module decls */ +#include /* memset */ +#include /* decls for HAL implementation */ #include "emcmotglb.h" #include "motion.h" #include "motion_debug.h" #include "motion_struct.h" #include "mot_priv.h" -#include "rtapi_math.h" +#include + +#ifndef _LINUX_MODULE_H +#include +#endif // vtable signatures #define VTKINS_VERSION VTKINEMATICS_VERSION1 diff --git a/src/emc/motion/motion.h b/src/emc/motion/motion.h index fbd0c9cd4..cef4d7c3c 100644 --- a/src/emc/motion/motion.h +++ b/src/emc/motion/motion.h @@ -77,15 +77,15 @@ to another. #ifndef MOTION_H #define MOTION_H -#include "hal.h" -#include "posemath.h" /* PmCartesian, PmPose, pmCartMag() */ -#include "emcpos.h" /* EmcPose */ -#include "cubic.h" /* CUBIC_STRUCT, CUBIC_COEFF */ +#include +#include /* PmCartesian, PmPose, pmCartMag() */ +#include /* EmcPose */ +#include /* CUBIC_STRUCT, CUBIC_COEFF */ #include "emcmotcfg.h" /* EMCMOT_MAX_JOINTS */ -#include "kinematics.h" -#include "rtapi_limits.h" +#include +#include /* INT_MIN */ #include "motion_id.h" -#include "tp.h" +#include #include #include "state_tag.h" diff --git a/src/emc/motion/motion_debug.h b/src/emc/motion/motion_debug.h index c854ce134..b27c9558b 100644 --- a/src/emc/motion/motion_debug.h +++ b/src/emc/motion/motion_debug.h @@ -15,9 +15,9 @@ #define MOTION_DEBUG_H /*! \todo needs mot_priv.h, but including here causes conflicts */ -#include "tp.h" /* TP_STRUCT */ -#include "tp_shared.h" // tp_shared_t -#include "tc.h" /* TC_STRUCT, TC_QUEUE_STRUCT */ +#include /* TP_STRUCT */ +#include // tp_shared_t +#include /* TC_STRUCT, TC_QUEUE_STRUCT */ /********************************* DEBUG STRUCTURE diff --git a/src/emc/motion/motion_id.h b/src/emc/motion/motion_id.h index e6da023d2..8c5070b08 100644 --- a/src/emc/motion/motion_id.h +++ b/src/emc/motion/motion_id.h @@ -4,7 +4,7 @@ #ifndef MOTION_ID_H #define MOTION_ID_H -#include "rtapi_limits.h" +//#include // define a special value to denote an invalid motion ID // NB: do not ever generate a motion id of MOTION_INVALID_ID // this should be really be tested for in command.c diff --git a/src/emc/motion/rtapi.h b/src/emc/motion/rtapi.h deleted file mode 120000 index 19ace0fa7..000000000 --- a/src/emc/motion/rtapi.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi.h \ No newline at end of file diff --git a/src/emc/motion/rtapi_app.h b/src/emc/motion/rtapi_app.h deleted file mode 120000 index 44c07b6c3..000000000 --- a/src/emc/motion/rtapi_app.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_app.h \ No newline at end of file diff --git a/src/emc/motion/rtapi_errno.h b/src/emc/motion/rtapi_errno.h deleted file mode 120000 index a7c499fbe..000000000 --- a/src/emc/motion/rtapi_errno.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_errno.h \ No newline at end of file diff --git a/src/emc/motion/rtapi_exception.h b/src/emc/motion/rtapi_exception.h deleted file mode 120000 index b36191755..000000000 --- a/src/emc/motion/rtapi_exception.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_exception.h \ No newline at end of file diff --git a/src/emc/motion/rtapi_global.h b/src/emc/motion/rtapi_global.h deleted file mode 120000 index 6dd28b7aa..000000000 --- a/src/emc/motion/rtapi_global.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_global.h \ No newline at end of file diff --git a/src/emc/motion/rtapi_heap.h b/src/emc/motion/rtapi_heap.h deleted file mode 120000 index c43e557ad..000000000 --- a/src/emc/motion/rtapi_heap.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_heap.h \ No newline at end of file diff --git a/src/emc/motion/rtapi_heap_private.h b/src/emc/motion/rtapi_heap_private.h deleted file mode 120000 index 09d0c0749..000000000 --- a/src/emc/motion/rtapi_heap_private.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_heap_private.h \ No newline at end of file diff --git a/src/emc/motion/rtapi_limits.h b/src/emc/motion/rtapi_limits.h deleted file mode 120000 index d08ccf37e..000000000 --- a/src/emc/motion/rtapi_limits.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_limits.h \ No newline at end of file diff --git a/src/emc/motion/rtapi_math.h b/src/emc/motion/rtapi_math.h deleted file mode 120000 index cdb837d6c..000000000 --- a/src/emc/motion/rtapi_math.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_math.h \ No newline at end of file diff --git a/src/emc/motion/rtapi_string.h b/src/emc/motion/rtapi_string.h deleted file mode 120000 index 7724188d2..000000000 --- a/src/emc/motion/rtapi_string.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_string.h \ No newline at end of file diff --git a/src/emc/motion/usrmotintf.cc b/src/emc/motion/usrmotintf.cc index 4b86d2b33..01d145063 100644 --- a/src/emc/motion/usrmotintf.cc +++ b/src/emc/motion/usrmotintf.cc @@ -15,7 +15,7 @@ * Last change: ********************************************************************/ -#include "config.h" /* LINELEN definition */ +#include /* LINELEN definition */ #include /* exit() */ #include #include /* memcpy() */ @@ -26,15 +26,15 @@ #include "emcmotcfg.h" /* EMCMOT_ERROR_NUM,LEN */ #include "emcmotglb.h" /* SHMEM_KEY */ #include "usrmotintf.h" /* these decls */ -#include "_timer.h" -#include "rcs_print.hh" +#include +#include -#include "inifile.hh" +#include #define READ_TIMEOUT_SEC 0 /* seconds for timeout */ #define READ_TIMEOUT_USEC 100000 /* microseconds for timeout */ -#include "rtapi.h" +#include #include "dbuf.h" #include "stashf.h" diff --git a/src/emc/nml_intf/CMakeLists.txt b/src/emc/nml_intf/CMakeLists.txt new file mode 100644 index 000000000..4e13ebf07 --- /dev/null +++ b/src/emc/nml_intf/CMakeLists.txt @@ -0,0 +1,33 @@ +cmake_minimum_required(VERSION 2.8) +set (project nml_intf) + +set(${project}_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/emcglb.c + ${CMAKE_CURRENT_SOURCE_DIR}/emcargs.cc + ${CMAKE_CURRENT_SOURCE_DIR}/emcops.cc + ${CMAKE_CURRENT_SOURCE_DIR}/emcpose.c + ${CMAKE_CURRENT_SOURCE_DIR}/canon_position.cc + ${CMAKE_CURRENT_SOURCE_DIR}/interpl.cc + ${CMAKE_CURRENT_SOURCE_DIR}/emc.cc +) + +set(${project}_HEADERS + ${CMAKE_CURRENT_SOURCE_DIR}/interpl.hh + ${CMAKE_CURRENT_SOURCE_DIR}/emcglb.h + ${CMAKE_CURRENT_SOURCE_DIR}/emc_nml.hh + ${CMAKE_CURRENT_SOURCE_DIR}/interp_return.hh + ${CMAKE_CURRENT_SOURCE_DIR}/emc.hh + ${CMAKE_CURRENT_SOURCE_DIR}/motion_types.h + ${CMAKE_CURRENT_SOURCE_DIR}/emccfg.h + ${CMAKE_CURRENT_SOURCE_DIR}/debugflags.h + ${CMAKE_CURRENT_SOURCE_DIR}/emcpose.h + ${CMAKE_CURRENT_SOURCE_DIR}/emctool.h + ${CMAKE_CURRENT_SOURCE_DIR}/canon_position.hh + ${CMAKE_CURRENT_SOURCE_DIR}/emcpos.h + ${CMAKE_CURRENT_SOURCE_DIR}/canon.hh +) + +include_directories(../) + +add_library(${project} OBJECT ${${project}_SOURCES} ${${project}_HEADERS} ) +target_compile_options(${project} PUBLIC -fPIC) diff --git a/src/emc/nml_intf/canon.hh b/src/emc/nml_intf/canon.hh index f9a062a69..0d7be3b8c 100644 --- a/src/emc/nml_intf/canon.hh +++ b/src/emc/nml_intf/canon.hh @@ -18,7 +18,7 @@ #include "emcpos.h" #include "emctool.h" -#include "modal_state.hh" +#include /* This is the header file that all applications that use the diff --git a/src/emc/nml_intf/canon_position.cc b/src/emc/nml_intf/canon_position.cc index ad5792b51..ac8bbd5f1 100644 --- a/src/emc/nml_intf/canon_position.cc +++ b/src/emc/nml_intf/canon_position.cc @@ -13,8 +13,8 @@ ********************************************************************/ #include "canon_position.hh" -#include "rtapi_math.h" -#include "posemath.h" +#include +#include static double noElement = 0.0; diff --git a/src/emc/nml_intf/canon_position.hh b/src/emc/nml_intf/canon_position.hh index e0d3cc733..2efabfd55 100644 --- a/src/emc/nml_intf/canon_position.hh +++ b/src/emc/nml_intf/canon_position.hh @@ -19,7 +19,7 @@ #include "emcpos.h" #include "emctool.h" -#include "posemath.h" // For PM_CARTESIAN type +#include // For PM_CARTESIAN type struct CANON_POSITION { #ifndef JAVA_DIAG_APPLET diff --git a/src/emc/nml_intf/emc.cc b/src/emc/nml_intf/emc.cc index 9d29be6c2..10ad1ffc6 100644 --- a/src/emc/nml_intf/emc.cc +++ b/src/emc/nml_intf/emc.cc @@ -18,7 +18,7 @@ ********************************************************************/ // Include all NML, CMS, and RCS classes and functions -#include "rcs.hh" +#include // Include command and status message definitions #include "canon.hh" @@ -27,7 +27,7 @@ #include "emc_nml.hh" #include "emcglb.h" #include "emcpos.h" -#include "cms.hh" +#include // Forward Function Prototypes void EmcPose_update(CMS * cms, EmcPose * x); diff --git a/src/emc/nml_intf/emc.hh b/src/emc/nml_intf/emc.hh index 353ee3b92..da1b2ac99 100644 --- a/src/emc/nml_intf/emc.hh +++ b/src/emc/nml_intf/emc.hh @@ -15,12 +15,12 @@ #ifndef EMC_HH #define EMC_HH -#include "config.h" +#include #include "emcglb.h" // EMC_AXIS_MAX -#include "nml_type.hh" +#include #include "motion_types.h" #include -#include "modal_state.hh" +#include // Forward class declarations class EMC_AXIS_STAT; diff --git a/src/emc/nml_intf/emc_nml.hh b/src/emc/nml_intf/emc_nml.hh index 37e1a7c9d..dc6aa4a86 100644 --- a/src/emc/nml_intf/emc_nml.hh +++ b/src/emc/nml_intf/emc_nml.hh @@ -15,13 +15,13 @@ #ifndef EMC_NML_HH #define EMC_NML_HH #include "emc.hh" -#include "rcs.hh" -#include "cmd_msg.hh" -#include "stat_msg.hh" +#include +#include +#include #include "emcpos.h" -#include "modal_state.hh" +#include #include "canon.hh" // CANON_TOOL_TABLE, CANON_UNITS -#include "rs274ngc.hh" // ACTIVE_G_CODES, etc +#include // ACTIVE_G_CODES, etc // ------------------ // CLASS DECLARATIONS diff --git a/src/emc/nml_intf/emcargs.cc b/src/emc/nml_intf/emcargs.cc index df6a95901..549025a2a 100644 --- a/src/emc/nml_intf/emcargs.cc +++ b/src/emc/nml_intf/emcargs.cc @@ -15,10 +15,10 @@ #include /* strcpy() */ #include /* fgets() */ -#include "nml.hh" /* nmlSetHostAlias */ +#include /* nmlSetHostAlias */ #include "emcglb.h" /* these decls */ #include "emccfg.h" /* their initial values */ -#include "rcs_print.hh" +#include int emcGetArgs(int argc, char *argv[]) { diff --git a/src/emc/nml_intf/emcglb.h b/src/emc/nml_intf/emcglb.h index 11a61c1f8..17d8eb632 100644 --- a/src/emc/nml_intf/emcglb.h +++ b/src/emc/nml_intf/emcglb.h @@ -15,9 +15,9 @@ #ifndef EMCGLB_H #define EMCGLB_H -#include "config.h" /* LINELEN */ -#include "rtapi_math.h" /* M_PI */ -#include "emcmotcfg.h" /* EMCMOT_MAX_DIO */ +#include /* LINELEN */ +#include /* M_PI */ +#include /* EMCMOT_MAX_DIO */ #include "debugflags.h" #ifdef __cplusplus diff --git a/src/emc/nml_intf/emcpos.h b/src/emc/nml_intf/emcpos.h index 4e2b80995..75074de33 100644 --- a/src/emc/nml_intf/emcpos.h +++ b/src/emc/nml_intf/emcpos.h @@ -14,7 +14,7 @@ #ifndef EMCPOS_H #define EMCPOS_H -#include "posemath.h" /* PmCartesian */ +#include /* PmCartesian */ typedef struct EmcPose { PmCartesian tran; diff --git a/src/emc/nml_intf/emcpose.c b/src/emc/nml_intf/emcpose.c index 2f113b62f..662cd827a 100644 --- a/src/emc/nml_intf/emcpose.c +++ b/src/emc/nml_intf/emcpose.c @@ -13,12 +13,12 @@ ********************************************************************/ #include "emcpose.h" -#include "posemath.h" -#include "rtapi_math.h" -#include "spherical_arc.h" -#include "blendmath.h" +#include +#include +#include +#include -#include "tp_debug.h" +#include //#define EMCPOSE_PEDANTIC diff --git a/src/emc/nml_intf/emcpose.h b/src/emc/nml_intf/emcpose.h index dc6b7e80e..43b8f7b11 100644 --- a/src/emc/nml_intf/emcpose.h +++ b/src/emc/nml_intf/emcpose.h @@ -14,7 +14,7 @@ #define EMCPOSE_H #include "emcpos.h" -#include "posemath.h" +#include typedef enum { EMCPOSE_ERR_OK = 0, diff --git a/src/emc/nml_intf/interpl.cc b/src/emc/nml_intf/interpl.cc index e44312736..1f2576fde 100644 --- a/src/emc/nml_intf/interpl.cc +++ b/src/emc/nml_intf/interpl.cc @@ -18,13 +18,13 @@ #include /* memcpy() */ -#include "rcs.hh" // LinkedList +#include // LinkedList #include "interpl.hh" // these decls #include "emc.hh" #include "emcglb.h" -#include "linklist.hh" -#include "nmlmsg.hh" /* class NMLmsg */ -#include "rcs_print.hh" +#include +#include /* class NMLmsg */ +#include NML_INTERP_LIST interp_list; /* NML Union, for interpreter */ diff --git a/src/emc/pythonplugin/CMakeLists.txt b/src/emc/pythonplugin/CMakeLists.txt new file mode 100644 index 000000000..03fb72c11 --- /dev/null +++ b/src/emc/pythonplugin/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8) +set (project pyplugin) + +set(${project}_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/exec.cc + ${CMAKE_CURRENT_SOURCE_DIR}/testpp.cc + ${CMAKE_CURRENT_SOURCE_DIR}/python_plugin.cc +) + +set(${project}_HEADERS + ${CMAKE_CURRENT_SOURCE_DIR}/python_plugin.hh +) + +add_library(${project} SHARED ${${project}_SOURCES} ${${project}_HEADERS} ) +target_link_libraries(${project} mkini) + +install(TARGETS ${project} + LIBRARY DESTINATION lib +) diff --git a/src/emc/rs274ngc/CMakeLists.txt b/src/emc/rs274ngc/CMakeLists.txt new file mode 100644 index 000000000..a82459902 --- /dev/null +++ b/src/emc/rs274ngc/CMakeLists.txt @@ -0,0 +1,130 @@ +cmake_minimum_required(VERSION 2.8) +set (project rs274) + +set(${project}_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/interp_execute.cc + ${CMAKE_CURRENT_SOURCE_DIR}/interp_base.cc + ${CMAKE_CURRENT_SOURCE_DIR}/rs274ngc_pre.cc + ${CMAKE_CURRENT_SOURCE_DIR}/interp_internal.cc + ${CMAKE_CURRENT_SOURCE_DIR}/interp_o_word.cc + ${CMAKE_CURRENT_SOURCE_DIR}/interp_remap.cc + ${CMAKE_CURRENT_SOURCE_DIR}/interp_inverse.cc + ${CMAKE_CURRENT_SOURCE_DIR}/pyemctypes.cc + ${CMAKE_CURRENT_SOURCE_DIR}/pyblock.cc + ${CMAKE_CURRENT_SOURCE_DIR}/canonmodule.cc + ${CMAKE_CURRENT_SOURCE_DIR}/interpmodule.cc + ${CMAKE_CURRENT_SOURCE_DIR}/interp_array.cc + ${CMAKE_CURRENT_SOURCE_DIR}/interp_read.cc + ${CMAKE_CURRENT_SOURCE_DIR}/interp_arc.cc + ${CMAKE_CURRENT_SOURCE_DIR}/interp_convert.cc + ${CMAKE_CURRENT_SOURCE_DIR}/interp_setup.cc + ${CMAKE_CURRENT_SOURCE_DIR}/interp_namedparams.cc + ${CMAKE_CURRENT_SOURCE_DIR}/pyparamclass.cc + ${CMAKE_CURRENT_SOURCE_DIR}/interp_python.cc + ${CMAKE_CURRENT_SOURCE_DIR}/interp_find.cc + ${CMAKE_CURRENT_SOURCE_DIR}/interp_check.cc + ${CMAKE_CURRENT_SOURCE_DIR}/interp_queue.cc + ${CMAKE_CURRENT_SOURCE_DIR}/nurbs_additional_functions.cc + ${CMAKE_CURRENT_SOURCE_DIR}/interp_cycles.cc + ${CMAKE_CURRENT_SOURCE_DIR}/tool_parse.cc + ${CMAKE_CURRENT_SOURCE_DIR}/interp_write.cc + ${CMAKE_CURRENT_SOURCE_DIR}/pyinterp1.cc + ${CMAKE_CURRENT_SOURCE_DIR}/modal_state.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gcodemodule.cc + ${CMAKE_CURRENT_SOURCE_DIR}/pyarrays.cc +) + +set(${project}_HEADERS + ${CMAKE_CURRENT_SOURCE_DIR}/interp_internal.hh + ${CMAKE_CURRENT_SOURCE_DIR}/modal_state.hh + ${CMAKE_CURRENT_SOURCE_DIR}/pb_decode.h + ${CMAKE_CURRENT_SOURCE_DIR}/tool_parse.h + ${CMAKE_CURRENT_SOURCE_DIR}/interp_array_types.hh + ${CMAKE_CURRENT_SOURCE_DIR}/array1.hh + ${CMAKE_CURRENT_SOURCE_DIR}/paramclass.hh + ${CMAKE_CURRENT_SOURCE_DIR}/rs274ngc_interp.hh + ${CMAKE_CURRENT_SOURCE_DIR}/pb_encode.h + ${CMAKE_CURRENT_SOURCE_DIR}/pb.h + ${CMAKE_CURRENT_SOURCE_DIR}/pb_common.h + ${CMAKE_CURRENT_SOURCE_DIR}/rs274ngc.hh + ${CMAKE_CURRENT_SOURCE_DIR}/interp_base.hh + ${CMAKE_CURRENT_SOURCE_DIR}/rs274ngc_return.hh + ${CMAKE_CURRENT_SOURCE_DIR}/pbutil.hh + ${CMAKE_CURRENT_SOURCE_DIR}/interp_queue.hh + ${CMAKE_CURRENT_SOURCE_DIR}/units.h +) + +#add_subdirectory(preview) + +include_directories(../) + +add_library(${project}_objs OBJECT ${${project}_SOURCES} ${${project}_HEADERS} ) +target_compile_options(${project}_objs PUBLIC -fPIC) + +add_library(${project} SHARED ${${project}_SOURCES} ${${project}_HEADERS} ) +target_link_libraries(${project} rtapi_math mkhal) + +install( + TARGETS ${project} + LIBRARY DESTINATION lib +) + +# -- gcode Python module + +set(GCODE_MODULE_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/gcodemodule.cc +) + +# GCODEMODULE := ../lib/python/gcode.so +add_library(gcode SHARED ${GCODE_MODULE_SOURCES} ${${project}_HEADERS} ) +target_link_libraries(gcode ${project} pyplugin Boost::python27) +set_target_properties(gcode PROPERTIES PREFIX "") + +install( + TARGETS gcode + DESTINATION ${Python2_SITELIB} +) + +# -- emccanon Python module + +set(EMCCANON_MODULE_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/canonmodule.cc +) + +add_library(emccanon SHARED ${EMCCANON_MODULE_SOURCES} ${${project}_HEADERS} ) +target_link_libraries(emccanon ${project} pyplugin Boost::python27) +set_target_properties(emccanon PROPERTIES PREFIX "") + +install( + TARGETS emccanon + DESTINATION ${Python2_SITELIB} +) + +# -- interp Python module + +set(INTERP_MODULE_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/interpmodule.cc +) + +add_library(interpreter SHARED ${INTERP_MODULE_SOURCES} ${${project}_HEADERS} ) +target_link_libraries(interpreter ${project} pyplugin Boost::python27) +set_target_properties(interpreter PROPERTIES PREFIX "") + +install( + TARGETS interpreter + DESTINATION ${Python2_SITELIB} +) + +# -- Preview + +set(preview_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/previewmodule.cc +) + +add_library(preview SHARED ${preview_SOURCES}) +target_link_libraries(preview ${project} pyplugin mktalk-pb2++ mtalk Boost::python27 czmq protobuf stdc++) +set_target_properties(preview PROPERTIES PREFIX "") + +install(TARGETS preview + DESTINATION ${Python2_SITELIB} +) diff --git a/src/emc/rs274ngc/canon.npb.h b/src/emc/rs274ngc/canon.npb.h deleted file mode 120000 index 2bb701d8d..000000000 --- a/src/emc/rs274ngc/canon.npb.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/canon.npb.h \ No newline at end of file diff --git a/src/emc/rs274ngc/canon.pb.h b/src/emc/rs274ngc/canon.pb.h deleted file mode 120000 index f24f424e1..000000000 --- a/src/emc/rs274ngc/canon.pb.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/canon.pb.h \ No newline at end of file diff --git a/src/emc/rs274ngc/config.npb.h b/src/emc/rs274ngc/config.npb.h deleted file mode 120000 index b3705fbe9..000000000 --- a/src/emc/rs274ngc/config.npb.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/config.npb.h \ No newline at end of file diff --git a/src/emc/rs274ngc/config.pb.h b/src/emc/rs274ngc/config.pb.h deleted file mode 120000 index 1a9aff2ed..000000000 --- a/src/emc/rs274ngc/config.pb.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/config.pb.h \ No newline at end of file diff --git a/src/emc/rs274ngc/emcclass.npb.h b/src/emc/rs274ngc/emcclass.npb.h deleted file mode 120000 index ea337b8a4..000000000 --- a/src/emc/rs274ngc/emcclass.npb.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/emcclass.npb.h \ No newline at end of file diff --git a/src/emc/rs274ngc/emcclass.pb.h b/src/emc/rs274ngc/emcclass.pb.h deleted file mode 120000 index 22c0e2afe..000000000 --- a/src/emc/rs274ngc/emcclass.pb.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/emcclass.pb.h \ No newline at end of file diff --git a/src/emc/rs274ngc/firmware.npb.h b/src/emc/rs274ngc/firmware.npb.h deleted file mode 120000 index 711997c55..000000000 --- a/src/emc/rs274ngc/firmware.npb.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/firmware.npb.h \ No newline at end of file diff --git a/src/emc/rs274ngc/firmware.pb.h b/src/emc/rs274ngc/firmware.pb.h deleted file mode 120000 index 09e344ed5..000000000 --- a/src/emc/rs274ngc/firmware.pb.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/firmware.pb.h \ No newline at end of file diff --git a/src/emc/rs274ngc/gcodemodule.cc b/src/emc/rs274ngc/gcodemodule.cc index 8eaacc89f..bea597290 100644 --- a/src/emc/rs274ngc/gcodemodule.cc +++ b/src/emc/rs274ngc/gcodemodule.cc @@ -21,19 +21,21 @@ #include "rs274ngc.hh" #include "rs274ngc_interp.hh" -#include "interp_return.hh" -#include "canon.hh" -#include "config.h" // LINELEN +#include +#include +#include // LINELEN int _task = 0; // control preview behaviour when remapping char _parameter_file_name[LINELEN]; -extern "C" void initinterpreter(); -extern "C" void initemccanon(); +//extern "C" void initinterpreter(); +//extern "C" void initemccanon(); +// Forward declaration +extern "C" void initgcode(); extern "C" struct _inittab builtin_modules[]; struct _inittab builtin_modules[] = { - { (char *) "interpreter", initinterpreter }, - { (char *) "emccanon", initemccanon }, + //{ (char *) "interpreter", initinterpreter }, + //{ (char *) "emccanon", initemccanon }, // any others... { NULL, NULL } }; diff --git a/src/emc/rs274ngc/hal.h b/src/emc/rs274ngc/hal.h deleted file mode 120000 index 04798acf6..000000000 --- a/src/emc/rs274ngc/hal.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/hal.h \ No newline at end of file diff --git a/src/emc/rs274ngc/hal_accessor.h b/src/emc/rs274ngc/hal_accessor.h deleted file mode 120000 index b3285a101..000000000 --- a/src/emc/rs274ngc/hal_accessor.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/hal_accessor.h \ No newline at end of file diff --git a/src/emc/rs274ngc/hal_accessor_macros.h b/src/emc/rs274ngc/hal_accessor_macros.h deleted file mode 120000 index d0ab249fa..000000000 --- a/src/emc/rs274ngc/hal_accessor_macros.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/hal_accessor_macros.h \ No newline at end of file diff --git a/src/emc/rs274ngc/hal_list.h b/src/emc/rs274ngc/hal_list.h deleted file mode 120000 index 6343a58af..000000000 --- a/src/emc/rs274ngc/hal_list.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/hal_list.h \ No newline at end of file diff --git a/src/emc/rs274ngc/hal_logging.h b/src/emc/rs274ngc/hal_logging.h deleted file mode 120000 index c78e490ad..000000000 --- a/src/emc/rs274ngc/hal_logging.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/hal_logging.h \ No newline at end of file diff --git a/src/emc/rs274ngc/hal_object.h b/src/emc/rs274ngc/hal_object.h deleted file mode 120000 index 5d6d2dfe0..000000000 --- a/src/emc/rs274ngc/hal_object.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/hal_object.h \ No newline at end of file diff --git a/src/emc/rs274ngc/hal_object_selectors.h b/src/emc/rs274ngc/hal_object_selectors.h deleted file mode 120000 index 36734bdd8..000000000 --- a/src/emc/rs274ngc/hal_object_selectors.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/hal_object_selectors.h \ No newline at end of file diff --git a/src/emc/rs274ngc/hal_priv.h b/src/emc/rs274ngc/hal_priv.h deleted file mode 120000 index 73b4e6800..000000000 --- a/src/emc/rs274ngc/hal_priv.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/hal_priv.h \ No newline at end of file diff --git a/src/emc/rs274ngc/hal_types.h b/src/emc/rs274ngc/hal_types.h deleted file mode 120000 index 9caade8cc..000000000 --- a/src/emc/rs274ngc/hal_types.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/hal_types.h \ No newline at end of file diff --git a/src/emc/rs274ngc/interp_base.hh b/src/emc/rs274ngc/interp_base.hh index 60f28259a..948aadc8d 100644 --- a/src/emc/rs274ngc/interp_base.hh +++ b/src/emc/rs274ngc/interp_base.hh @@ -16,8 +16,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include -#include -#include +#include +#include "modal_state.hh" /* Size of certain arrays */ #define ACTIVE_G_CODES 16 diff --git a/src/emc/rs274ngc/interp_execute.cc b/src/emc/rs274ngc/interp_execute.cc index c8ecab35f..9837384fc 100644 --- a/src/emc/rs274ngc/interp_execute.cc +++ b/src/emc/rs274ngc/interp_execute.cc @@ -18,7 +18,7 @@ #include #include #include -#include "rtapi_math.h" +#include #include #include #include diff --git a/src/emc/rs274ngc/interp_find.cc b/src/emc/rs274ngc/interp_find.cc index 6b6e3039e..36b3f33bf 100644 --- a/src/emc/rs274ngc/interp_find.cc +++ b/src/emc/rs274ngc/interp_find.cc @@ -17,13 +17,13 @@ #include #include #include -#include "rtapi_math.h" +#include #include #include #include #include #include "rs274ngc.hh" -#include "interp_return.hh" +#include #include "interp_internal.hh" #include "rs274ngc_interp.hh" #include "units.h" diff --git a/src/emc/rs274ngc/interp_internal.hh b/src/emc/rs274ngc/interp_internal.hh index 7bbe0ca11..294e069cc 100644 --- a/src/emc/rs274ngc/interp_internal.hh +++ b/src/emc/rs274ngc/interp_internal.hh @@ -16,16 +16,16 @@ #include #include #include -#include "config.h" +#include #include #include #include #include #include -#include "canon.hh" -#include "emcpos.h" +#include +#include #include "libintl.h" -#include "python_plugin.hh" +#include #define _(s) gettext(s) diff --git a/src/emc/rs274ngc/interp_inverse.cc b/src/emc/rs274ngc/interp_inverse.cc index b41c5bf25..ee8259d95 100644 --- a/src/emc/rs274ngc/interp_inverse.cc +++ b/src/emc/rs274ngc/interp_inverse.cc @@ -15,13 +15,13 @@ #include #include #include -#include "rtapi_math.h" +#include #include #include #include #include #include "rs274ngc.hh" -#include "interp_return.hh" +#include #include "interp_internal.hh" #include "interp_queue.hh" #include "rs274ngc_interp.hh" diff --git a/src/emc/rs274ngc/interp_o_word.cc b/src/emc/rs274ngc/interp_o_word.cc index 769bfd83d..a9048bae9 100644 --- a/src/emc/rs274ngc/interp_o_word.cc +++ b/src/emc/rs274ngc/interp_o_word.cc @@ -16,7 +16,7 @@ #include #include #include -#include "rtapi_math.h" +#include #include #include #include @@ -25,7 +25,7 @@ #include #include "rs274ngc.hh" #include "rs274ngc_return.hh" -#include "interp_return.hh" +#include #include "interp_internal.hh" #include "rs274ngc_interp.hh" #include "inifile.hh" // strstore() diff --git a/src/emc/rs274ngc/interp_python.cc b/src/emc/rs274ngc/interp_python.cc index 1a54e1221..71f89b097 100644 --- a/src/emc/rs274ngc/interp_python.cc +++ b/src/emc/rs274ngc/interp_python.cc @@ -23,7 +23,7 @@ namespace bp = boost::python; #include #include #include -#include "rtapi_math.h" +#include #include #include #include @@ -31,7 +31,7 @@ namespace bp = boost::python; #include #include "rs274ngc.hh" -#include "interp_return.hh" +#include #include "interp_internal.hh" #include "rs274ngc_interp.hh" #include "units.h" diff --git a/src/emc/rs274ngc/interp_write.cc b/src/emc/rs274ngc/interp_write.cc index b9dd1633e..06d1bf42d 100644 --- a/src/emc/rs274ngc/interp_write.cc +++ b/src/emc/rs274ngc/interp_write.cc @@ -14,13 +14,13 @@ #include #include #include -#include "rtapi_math.h" +#include #include #include #include #include #include "rs274ngc.hh" -#include "interp_return.hh" +#include #include "interp_internal.hh" #include "rs274ngc_interp.hh" diff --git a/src/emc/rs274ngc/interpmodule.cc b/src/emc/rs274ngc/interpmodule.cc index 5421b3f99..6c8bb4ffb 100644 --- a/src/emc/rs274ngc/interpmodule.cc +++ b/src/emc/rs274ngc/interpmodule.cc @@ -14,7 +14,7 @@ extern int _task; // zero in gcodemodule, 1 in milltask #include #include "rs274ngc.hh" -#include "interp_return.hh" +#include #include "interp_internal.hh" #include "rs274ngc_interp.hh" #include "units.h" diff --git a/src/emc/rs274ngc/jplan.npb.h b/src/emc/rs274ngc/jplan.npb.h deleted file mode 120000 index 53a000a94..000000000 --- a/src/emc/rs274ngc/jplan.npb.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/jplan.npb.h \ No newline at end of file diff --git a/src/emc/rs274ngc/jplan.pb.h b/src/emc/rs274ngc/jplan.pb.h deleted file mode 120000 index ad6e9ad5f..000000000 --- a/src/emc/rs274ngc/jplan.pb.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/jplan.pb.h \ No newline at end of file diff --git a/src/emc/rs274ngc/log.npb.h b/src/emc/rs274ngc/log.npb.h deleted file mode 120000 index 7e296cb4f..000000000 --- a/src/emc/rs274ngc/log.npb.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/log.npb.h \ No newline at end of file diff --git a/src/emc/rs274ngc/log.pb.h b/src/emc/rs274ngc/log.pb.h deleted file mode 120000 index 5198f02c8..000000000 --- a/src/emc/rs274ngc/log.pb.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/log.pb.h \ No newline at end of file diff --git a/src/emc/rs274ngc/message.npb.h b/src/emc/rs274ngc/message.npb.h deleted file mode 120000 index 55788eb61..000000000 --- a/src/emc/rs274ngc/message.npb.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/message.npb.h \ No newline at end of file diff --git a/src/emc/rs274ngc/message.pb.h b/src/emc/rs274ngc/message.pb.h deleted file mode 120000 index d416ef229..000000000 --- a/src/emc/rs274ngc/message.pb.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/message.pb.h \ No newline at end of file diff --git a/src/emc/rs274ngc/modal_state.hh b/src/emc/rs274ngc/modal_state.hh index 4e67306e0..c255fb8d0 100644 --- a/src/emc/rs274ngc/modal_state.hh +++ b/src/emc/rs274ngc/modal_state.hh @@ -18,7 +18,7 @@ // Bring in C struct for a state tag from motion extern "C" { -#include "state_tag.h" +#include } /** diff --git a/src/emc/rs274ngc/motcmds.npb.h b/src/emc/rs274ngc/motcmds.npb.h deleted file mode 120000 index 56a5a101f..000000000 --- a/src/emc/rs274ngc/motcmds.npb.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/motcmds.npb.h \ No newline at end of file diff --git a/src/emc/rs274ngc/motcmds.pb.h b/src/emc/rs274ngc/motcmds.pb.h deleted file mode 120000 index d98590b21..000000000 --- a/src/emc/rs274ngc/motcmds.pb.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/motcmds.pb.h \ No newline at end of file diff --git a/src/emc/rs274ngc/nanopb.npb.h b/src/emc/rs274ngc/nanopb.npb.h deleted file mode 120000 index 94e228731..000000000 --- a/src/emc/rs274ngc/nanopb.npb.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/nanopb.npb.h \ No newline at end of file diff --git a/src/emc/rs274ngc/nanopb.pb.h b/src/emc/rs274ngc/nanopb.pb.h deleted file mode 120000 index 6fb61b354..000000000 --- a/src/emc/rs274ngc/nanopb.pb.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/nanopb.pb.h \ No newline at end of file diff --git a/src/emc/rs274ngc/nurbs_additional_functions.cc b/src/emc/rs274ngc/nurbs_additional_functions.cc index 28330f6ee..2201cf6ef 100644 --- a/src/emc/rs274ngc/nurbs_additional_functions.cc +++ b/src/emc/rs274ngc/nurbs_additional_functions.cc @@ -10,9 +10,9 @@ /* Those functions are needed to calculate NURBS points */ -#include "rtapi_math.h" +#include #include -#include "canon.hh" +#include static void unit(PLANE_POINT &p) { double h = rtapi_hypot(p.X, p.Y); diff --git a/src/emc/rs274ngc/object.npb.h b/src/emc/rs274ngc/object.npb.h deleted file mode 120000 index 62d4ca758..000000000 --- a/src/emc/rs274ngc/object.npb.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/object.npb.h \ No newline at end of file diff --git a/src/emc/rs274ngc/object.pb.h b/src/emc/rs274ngc/object.pb.h deleted file mode 120000 index 3728eaf8c..000000000 --- a/src/emc/rs274ngc/object.pb.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/object.pb.h \ No newline at end of file diff --git a/src/emc/rs274ngc/preview.npb.h b/src/emc/rs274ngc/preview.npb.h deleted file mode 120000 index 48f5836d2..000000000 --- a/src/emc/rs274ngc/preview.npb.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/preview.npb.h \ No newline at end of file diff --git a/src/emc/rs274ngc/preview.pb.h b/src/emc/rs274ngc/preview.pb.h deleted file mode 120000 index f302eb191..000000000 --- a/src/emc/rs274ngc/preview.pb.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/preview.pb.h \ No newline at end of file diff --git a/src/emc/rs274ngc/preview/CMakeLists.txt b/src/emc/rs274ngc/preview/CMakeLists.txt new file mode 100644 index 000000000..c01eb8a2b --- /dev/null +++ b/src/emc/rs274ngc/preview/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8) +set (project preview) + diff --git a/src/emc/rs274ngc/previewmodule.cc b/src/emc/rs274ngc/previewmodule.cc index 101ae343b..2db260528 100644 --- a/src/emc/rs274ngc/previewmodule.cc +++ b/src/emc/rs274ngc/previewmodule.cc @@ -22,18 +22,18 @@ #include -#include "types.pb.h" -#include "message.pb.h" +#include +#include using namespace google::protobuf; #include "rs274ngc.hh" #include "rs274ngc_interp.hh" -#include "interp_return.hh" -#include "canon.hh" -#include "config.h" // LINELEN +#include +#include +#include // LINELEN -#include "czmq.h" -#include "pbutil.hh" // hal/haltalk +#include +#include // hal/haltalk static zsock_t *z_preview, *z_status; static const char *istat_topic = "status"; @@ -150,12 +150,14 @@ static void z_shutdown(void) } char _parameter_file_name[LINELEN]; -extern "C" void initinterpreter(); -extern "C" void initemccanon(); +//extern "C" void initinterpreter(); +//extern "C" void initemccanon(); +// Forward declaration +extern "C" void initpreview(); extern "C" struct _inittab builtin_modules[]; struct _inittab builtin_modules[] = { - { (char *) "interpreter", initinterpreter }, - { (char *) "emccanon", initemccanon }, + //{ (char *) "interpreter", initinterpreter }, + //{ (char *) "emccanon", initemccanon }, // any others... { NULL, NULL } }; diff --git a/src/emc/rs274ngc/pyparamclass.cc b/src/emc/rs274ngc/pyparamclass.cc index 42a543719..6287959b2 100644 --- a/src/emc/rs274ngc/pyparamclass.cc +++ b/src/emc/rs274ngc/pyparamclass.cc @@ -14,7 +14,7 @@ extern int _task; // zero in gcodemodule, 1 in milltask #include #include "rs274ngc.hh" -#include "interp_return.hh" +#include #include "interp_internal.hh" #include "rs274ngc_interp.hh" #include "paramclass.hh" diff --git a/src/emc/rs274ngc/ros.npb.h b/src/emc/rs274ngc/ros.npb.h deleted file mode 120000 index fc90b0030..000000000 --- a/src/emc/rs274ngc/ros.npb.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/ros.npb.h \ No newline at end of file diff --git a/src/emc/rs274ngc/ros.pb.h b/src/emc/rs274ngc/ros.pb.h deleted file mode 120000 index f03812277..000000000 --- a/src/emc/rs274ngc/ros.pb.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/ros.pb.h \ No newline at end of file diff --git a/src/emc/rs274ngc/rs274ngc.hh b/src/emc/rs274ngc/rs274ngc.hh index 11a53b606..b41d16f76 100644 --- a/src/emc/rs274ngc/rs274ngc.hh +++ b/src/emc/rs274ngc/rs274ngc.hh @@ -22,9 +22,9 @@ /**********************/ #include -#include "canon.hh" -#include "emc.hh" -#include "debugflags.h" +#include +#include +#include typedef struct setup_struct setup; #ifndef JAVA_DIAG_APPLET diff --git a/src/emc/rs274ngc/rs274ngc_pre.cc b/src/emc/rs274ngc/rs274ngc_pre.cc index 3f3c44d99..2cb8c56ee 100644 --- a/src/emc/rs274ngc/rs274ngc_pre.cc +++ b/src/emc/rs274ngc/rs274ngc_pre.cc @@ -115,8 +115,8 @@ Interp::Interp() init_named_parameters(); // need this before Python init. if (!PythonPlugin::instantiate(builtin_modules)) { // factory - Error("Interp ctor: cant instantiate Python plugin"); - return; + Error("Interp ctor: cant instantiate Python plugin"); + return; } try { diff --git a/src/emc/rs274ngc/rs274ngc_return.hh b/src/emc/rs274ngc/rs274ngc_return.hh index ba3eab725..ce0080c37 100644 --- a/src/emc/rs274ngc/rs274ngc_return.hh +++ b/src/emc/rs274ngc/rs274ngc_return.hh @@ -15,7 +15,7 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #ifndef RS274NGC_RETURN_HH #define RS274NGC_RETURN_HH -#include "interp_return.hh" +#include #define NCE_A_FILE_IS_ALREADY_OPEN _("A file is already open") #define NCE_ALL_AXES_MISSING_WITH_G52_OR_G92 \ _("All axes missing with g52 or g92") diff --git a/src/emc/rs274ngc/rtapi.h b/src/emc/rs274ngc/rtapi.h deleted file mode 120000 index 19ace0fa7..000000000 --- a/src/emc/rs274ngc/rtapi.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi.h \ No newline at end of file diff --git a/src/emc/rs274ngc/rtapi_errno.h b/src/emc/rs274ngc/rtapi_errno.h deleted file mode 120000 index a7c499fbe..000000000 --- a/src/emc/rs274ngc/rtapi_errno.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_errno.h \ No newline at end of file diff --git a/src/emc/rs274ngc/rtapi_exception.h b/src/emc/rs274ngc/rtapi_exception.h deleted file mode 120000 index b36191755..000000000 --- a/src/emc/rs274ngc/rtapi_exception.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_exception.h \ No newline at end of file diff --git a/src/emc/rs274ngc/rtapi_global.h b/src/emc/rs274ngc/rtapi_global.h deleted file mode 120000 index 6dd28b7aa..000000000 --- a/src/emc/rs274ngc/rtapi_global.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_global.h \ No newline at end of file diff --git a/src/emc/rs274ngc/rtapi_heap.h b/src/emc/rs274ngc/rtapi_heap.h deleted file mode 120000 index c43e557ad..000000000 --- a/src/emc/rs274ngc/rtapi_heap.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_heap.h \ No newline at end of file diff --git a/src/emc/rs274ngc/rtapi_heap_private.h b/src/emc/rs274ngc/rtapi_heap_private.h deleted file mode 120000 index 09d0c0749..000000000 --- a/src/emc/rs274ngc/rtapi_heap_private.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_heap_private.h \ No newline at end of file diff --git a/src/emc/rs274ngc/rtapi_message.npb.h b/src/emc/rs274ngc/rtapi_message.npb.h deleted file mode 120000 index 0c266f240..000000000 --- a/src/emc/rs274ngc/rtapi_message.npb.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_message.npb.h \ No newline at end of file diff --git a/src/emc/rs274ngc/rtapi_message.pb.h b/src/emc/rs274ngc/rtapi_message.pb.h deleted file mode 120000 index 71ea1fd1f..000000000 --- a/src/emc/rs274ngc/rtapi_message.pb.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_message.pb.h \ No newline at end of file diff --git a/src/emc/rs274ngc/rtapicommand.npb.h b/src/emc/rs274ngc/rtapicommand.npb.h deleted file mode 120000 index b4b66dd83..000000000 --- a/src/emc/rs274ngc/rtapicommand.npb.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapicommand.npb.h \ No newline at end of file diff --git a/src/emc/rs274ngc/rtapicommand.pb.h b/src/emc/rs274ngc/rtapicommand.pb.h deleted file mode 120000 index 37107974f..000000000 --- a/src/emc/rs274ngc/rtapicommand.pb.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapicommand.pb.h \ No newline at end of file diff --git a/src/emc/rs274ngc/status.npb.h b/src/emc/rs274ngc/status.npb.h deleted file mode 120000 index 834a7b73a..000000000 --- a/src/emc/rs274ngc/status.npb.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/status.npb.h \ No newline at end of file diff --git a/src/emc/rs274ngc/status.pb.h b/src/emc/rs274ngc/status.pb.h deleted file mode 120000 index 775ed8d46..000000000 --- a/src/emc/rs274ngc/status.pb.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/status.pb.h \ No newline at end of file diff --git a/src/emc/rs274ngc/task.npb.h b/src/emc/rs274ngc/task.npb.h deleted file mode 120000 index 46b95eb11..000000000 --- a/src/emc/rs274ngc/task.npb.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/task.npb.h \ No newline at end of file diff --git a/src/emc/rs274ngc/task.pb.h b/src/emc/rs274ngc/task.pb.h deleted file mode 120000 index 1280652d8..000000000 --- a/src/emc/rs274ngc/task.pb.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/task.pb.h \ No newline at end of file diff --git a/src/emc/rs274ngc/test.npb.h b/src/emc/rs274ngc/test.npb.h deleted file mode 120000 index 87717a559..000000000 --- a/src/emc/rs274ngc/test.npb.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/test.npb.h \ No newline at end of file diff --git a/src/emc/rs274ngc/test.pb.h b/src/emc/rs274ngc/test.pb.h deleted file mode 120000 index 3bf27c7c2..000000000 --- a/src/emc/rs274ngc/test.pb.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/test.pb.h \ No newline at end of file diff --git a/src/emc/rs274ngc/tool_parse.cc b/src/emc/rs274ngc/tool_parse.cc index a4b5075bf..f3a780d44 100644 --- a/src/emc/rs274ngc/tool_parse.cc +++ b/src/emc/rs274ngc/tool_parse.cc @@ -16,8 +16,8 @@ #include #include #include -#include "emcglb.h" -#include "emctool.h" +#include +#include #include "tool_parse.h" static bool scan_old_style( diff --git a/src/emc/rs274ngc/tool_parse.h b/src/emc/rs274ngc/tool_parse.h index 684407b64..69a9899e2 100644 --- a/src/emc/rs274ngc/tool_parse.h +++ b/src/emc/rs274ngc/tool_parse.h @@ -16,7 +16,7 @@ #ifndef TOOL_PARSE_H #define TOOL_PARSE_H -#include "emctool.h" +#include #ifdef CPLUSPLUS extern "C" { #endif diff --git a/src/emc/rs274ngc/types.npb.h b/src/emc/rs274ngc/types.npb.h deleted file mode 120000 index 54627ba80..000000000 --- a/src/emc/rs274ngc/types.npb.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/types.npb.h \ No newline at end of file diff --git a/src/emc/rs274ngc/types.pb.h b/src/emc/rs274ngc/types.pb.h deleted file mode 120000 index 792df7938..000000000 --- a/src/emc/rs274ngc/types.pb.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/types.pb.h \ No newline at end of file diff --git a/src/emc/rs274ngc/value.npb.h b/src/emc/rs274ngc/value.npb.h deleted file mode 120000 index ae91ee1bf..000000000 --- a/src/emc/rs274ngc/value.npb.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/value.npb.h \ No newline at end of file diff --git a/src/emc/rs274ngc/value.pb.h b/src/emc/rs274ngc/value.pb.h deleted file mode 120000 index 021361c61..000000000 --- a/src/emc/rs274ngc/value.pb.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/value.pb.h \ No newline at end of file diff --git a/src/emc/sai/CMakeLists.txt b/src/emc/sai/CMakeLists.txt new file mode 100644 index 000000000..e0638cb44 --- /dev/null +++ b/src/emc/sai/CMakeLists.txt @@ -0,0 +1,27 @@ +cmake_minimum_required(VERSION 3.13) +set (project sai) + +set(${project}_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/builtin_modules.cc + ${CMAKE_CURRENT_SOURCE_DIR}/dummyemcstat.cc + ${CMAKE_CURRENT_SOURCE_DIR}/driver.cc +) + +if(WITH_NULLCANON) + list(APPEND ${project}_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/nullcanon.cc") +else() + list(APPEND ${project}_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/saicanon.cc") +endif() + +# for pythonplugin +include_directories(../) + +link_directories(${READLINE_LIBRARY_PATH}) + +add_executable(${project} ${${project}_SOURCES} ${${project}_HEADERS} ) +target_link_libraries(${project} mk nml mkhal pyplugin rtapi_math Boost::python27 ${PYTHON_LIBRARIES} readline dl) + +install(TARGETS ${project} + RUNTIME DESTINATION bin + RENAME rs274 +) diff --git a/src/emc/sai/builtin_modules.cc b/src/emc/sai/builtin_modules.cc index 5c64843dc..f5805c64b 100644 --- a/src/emc/sai/builtin_modules.cc +++ b/src/emc/sai/builtin_modules.cc @@ -1,13 +1,13 @@ -#include "python_plugin.hh" +#include -extern "C" void initemctask(); +//extern "C" void initemctask(); extern "C" void initinterpreter(); extern "C" void initemccanon(); struct _inittab builtin_modules[] = { { (char *) "interpreter", initinterpreter }, { (char *) "emccanon", initemccanon }, - { (char *) "emctask", initemctask }, + //{ (char *) "emctask", initemctask }, // any others... { NULL, NULL } }; diff --git a/src/emc/sai/driver.cc b/src/emc/sai/driver.cc index 3102ef62a..617cf08e5 100644 --- a/src/emc/sai/driver.cc +++ b/src/emc/sai/driver.cc @@ -18,13 +18,13 @@ * ********************************************************************/ -#include "rs274ngc.hh" -#include "rs274ngc_interp.hh" -#include "rs274ngc_return.hh" -#include "inifile.hh" // INIFILE -#include "canon.hh" // _parameter_file_name -#include "config.h" // LINELEN -#include "tool_parse.h" +#include +#include +#include +#include // INIFILE +#include // _parameter_file_name +#include // LINELEN +#include #include /* gets, etc. */ #include /* exit */ #include /* strcpy */ diff --git a/src/emc/sai/dummyemcstat.cc b/src/emc/sai/dummyemcstat.cc index 28f6e65bd..f817091f2 100644 --- a/src/emc/sai/dummyemcstat.cc +++ b/src/emc/sai/dummyemcstat.cc @@ -1,10 +1,10 @@ // keep linker happy so TaskMod can be resolved -#include "rcs.hh" // NML classes, nmlErrorFormat() -#include "emc.hh" // EMC NML -#include "emc_nml.hh" -#include "rs274ngc.hh" -#include "rs274ngc_interp.hh" +#include // NML classes, nmlErrorFormat() +#include // EMC NML +#include +#include +#include EMC_STAT *emcStatus = new EMC_STAT; diff --git a/src/emc/sai/nullcanon.cc b/src/emc/sai/nullcanon.cc index 4b59cf555..13bb0498d 100644 --- a/src/emc/sai/nullcanon.cc +++ b/src/emc/sai/nullcanon.cc @@ -3,10 +3,12 @@ * dummy layer for profiling the interpreter without any canon overhead ********************************************************************/ -#include "canon.hh" -#include "rs274ngc.hh" -#include "rs274ngc_interp.hh" -#include "rtapi_math.h" +#include +#include // EMC NML +#include +#include +#include +#include #include #include #include diff --git a/src/emc/sai/saicanon.cc b/src/emc/sai/saicanon.cc index 1bdd02033..84c8f8e72 100644 --- a/src/emc/sai/saicanon.cc +++ b/src/emc/sai/saicanon.cc @@ -31,10 +31,10 @@ * Last change: ********************************************************************/ -#include "canon.hh" -#include "rs274ngc.hh" -#include "rs274ngc_interp.hh" -#include "rtapi_math.h" +#include +#include +#include +#include #include #include #include diff --git a/src/emc/task/CMakeLists.txt b/src/emc/task/CMakeLists.txt new file mode 100644 index 000000000..25b7d053f --- /dev/null +++ b/src/emc/task/CMakeLists.txt @@ -0,0 +1,69 @@ +cmake_minimum_required(VERSION 3.13) +set (project task) + +set(${project}_HEADERS + ${CMAKE_CURRENT_SOURCE_DIR}/task.hh + ${CMAKE_CURRENT_SOURCE_DIR}/taskclass.hh +) + +include_directories(../) + +set(EMCSVR_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/emcsvr.cc +) + +add_executable(mksvr ${EMCSVR_SOURCES} ${${project}_HEADERS} ) +target_link_libraries(mksvr nml mk mkini rtapi_math) + +install(TARGETS mksvr + RUNTIME DESTINATION bin +) + +# disabled: emc/task/iotaskintf.cc +set(MILLTASK_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/../motion/emcmotglb.c + ${CMAKE_CURRENT_SOURCE_DIR}/../motion/usrmotintf.cc + ${CMAKE_CURRENT_SOURCE_DIR}/../motion/emcmotutil.c + ${CMAKE_CURRENT_SOURCE_DIR}/../motion/dbuf.c + ${CMAKE_CURRENT_SOURCE_DIR}/../motion/stashf.c + ${CMAKE_CURRENT_SOURCE_DIR}/emctask.cc + ${CMAKE_CURRENT_SOURCE_DIR}/emccanon.cc + ${CMAKE_CURRENT_SOURCE_DIR}/emctaskmain.cc + ${CMAKE_CURRENT_SOURCE_DIR}/taskintf.cc + ${CMAKE_CURRENT_SOURCE_DIR}/taskmodule.cc + ${CMAKE_CURRENT_SOURCE_DIR}/taskclass.cc + ${CMAKE_CURRENT_SOURCE_DIR}/backtrace.cc +) + +add_executable(milltask ${MILLTASK_SOURCES} ${${project}_HEADERS} ) +target_link_libraries(milltask rs274 mk nml posemath mkhal pyplugin Boost::python27 ${PYTHON_LIBRARIES}) + +install(TARGETS milltask + RUNTIME DESTINATION bin +) + +# -- emctask Python module + +set(EMCTASK_MODULE_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/../motion/usrmotintf.cc + ${CMAKE_CURRENT_SOURCE_DIR}/../motion/emcmotglb.c + ${CMAKE_CURRENT_SOURCE_DIR}/../motion/emcmotutil.c + ${CMAKE_CURRENT_SOURCE_DIR}/../motion/dbuf.c + ${CMAKE_CURRENT_SOURCE_DIR}/../motion/stashf.c + ${CMAKE_CURRENT_SOURCE_DIR}/taskclass.cc + ${CMAKE_CURRENT_SOURCE_DIR}/taskintf.cc + ${CMAKE_CURRENT_SOURCE_DIR}/emccanon.cc + ${CMAKE_CURRENT_SOURCE_DIR}/emctask.cc + ${CMAKE_CURRENT_SOURCE_DIR}/emctaskmain.cc + ${CMAKE_CURRENT_SOURCE_DIR}/backtrace.cc + ${CMAKE_CURRENT_SOURCE_DIR}/taskmodule.cc +) + +add_library(emctask SHARED ${EMCTASK_MODULE_SOURCES} ${${project}_HEADERS} ) +target_link_libraries(emctask nml mk_SHARED mkhal posemath pyplugin Boost::python27) +set_target_properties(emctask PROPERTIES PREFIX "") + +install( + TARGETS emctask + DESTINATION ${Python2_SITELIB} +) diff --git a/src/emc/task/emccanon.cc b/src/emc/task/emccanon.cc index 6b2a5b5a7..036349093 100644 --- a/src/emc/task/emccanon.cc +++ b/src/emc/task/emccanon.cc @@ -30,19 +30,19 @@ all appropriate values subsequently. */ -#include "config.h" +#include #include #include -#include "rtapi_math.h" +#include #include // strncpy() #include // isspace() -#include "emc.hh" // EMC NML -#include "emc_nml.hh" -#include "canon.hh" -#include "canon_position.hh" // data type for a machine position -#include "interpl.hh" // interp_list -#include "emcglb.h" // TRAJ_MAX_VELOCITY -#include "modal_state.hh" +#include // EMC NML +#include +#include +#include // data type for a machine position +#include // interp_list +#include // TRAJ_MAX_VELOCITY +#include //#define EMCCANON_DEBUG diff --git a/src/emc/task/emcsvr.cc b/src/emc/task/emcsvr.cc index 437a7b8e1..5042c780c 100644 --- a/src/emc/task/emcsvr.cc +++ b/src/emc/task/emcsvr.cc @@ -14,21 +14,21 @@ ********************************************************************/ #include // sscanf() -#include "rtapi_math.h" // fabs() +#include // fabs() #include // exit() #include // strncpy() #include // _exit() #include -#include "rcs.hh" // EMC NML -#include "emc.hh" // EMC NML -#include "emc_nml.hh" // EMC NML -#include "emcglb.h" // emcGetArgs(), EMC_NMLFILE -#include "inifile.hh" -#include "rcs_print.hh" -#include "nml_oi.hh" -#include "timer.hh" -#include "nml_srv.hh" // run_nml_servers() +#include // EMC NML +#include // EMC NML +#include // EMC NML +#include // emcGetArgs(), EMC_NMLFILE +#include +#include +#include +#include +#include // run_nml_servers() static int tool_channels = 1; diff --git a/src/emc/task/emctask.cc b/src/emc/task/emctask.cc index 80fecce0e..597de79f1 100644 --- a/src/emc/task/emctask.cc +++ b/src/emc/task/emctask.cc @@ -20,18 +20,18 @@ #include // PATH_MAX #include -#include "rcs.hh" // INIFILE -#include "emc.hh" // EMC NML -#include "emc_nml.hh" -#include "emcglb.h" // EMC_INIFILE -#include "interpl.hh" // NML_INTERP_LIST, interp_list -#include "canon.hh" // CANON_VECTOR, GET_PROGRAM_ORIGIN() -#include "rs274ngc_interp.hh" // the interpreter -#include "interp_return.hh" // INTERP_FILE_NOT_OPEN -#include "inifile.hh" -#include "rcs_print.hh" +#include // INIFILE +#include // EMC NML +#include +#include // EMC_INIFILE +#include // NML_INTERP_LIST, interp_list +#include // CANON_VECTOR, GET_PROGRAM_ORIGIN() +#include // the interpreter +#include // INTERP_FILE_NOT_OPEN +#include +#include #include "task.hh" // emcTaskCommand etc -#include "python_plugin.hh" +#include #include "taskclass.hh" diff --git a/src/emc/task/emctaskmain.cc b/src/emc/task/emctaskmain.cc index 58139ae1b..85101302f 100644 --- a/src/emc/task/emctaskmain.cc +++ b/src/emc/task/emctaskmain.cc @@ -66,22 +66,22 @@ fpu_control_t __fpu_control = _FPU_IEEE & ~(_FPU_MASK_IM | _FPU_MASK_ZM | _FPU_MASK_OM); #endif -#include "rcs.hh" // NML classes, nmlErrorFormat() -#include "emc.hh" // EMC NML -#include "emc_nml.hh" -#include "canon.hh" // CANON_TOOL_TABLE stuff -#include "inifile.hh" // INIFILE -#include "interpl.hh" // NML_INTERP_LIST, interp_list -#include "emcglb.h" // EMC_INIFILE,NMLFILE, EMC_TASK_CYCLE_TIME -#include "interp_return.hh" // public interpreter return values -#include "interp_internal.hh" // interpreter private definitions -#include "rcs_print.hh" -#include "timer.hh" -#include "nml_oi.hh" +#include // NML classes, nmlErrorFormat() +#include // EMC NML +#include +#include // CANON_TOOL_TABLE stuff +#include // INIFILE +#include // NML_INTERP_LIST, interp_list +#include // EMC_INIFILE,NMLFILE, EMC_TASK_CYCLE_TIME +#include // public interpreter return values +#include // interpreter private definitions +#include +#include +#include #include "task.hh" // emcTaskCommand etc #include "taskclass.hh" -#include "motion.h" // EMCMOT_ORIENT_* -#include "inihal.hh" +#include // EMCMOT_ORIENT_* +#include /* time after which the user interface is declared dead * because it would'nt read any more messages diff --git a/src/emc/task/iotaskintf.cc b/src/emc/task/iotaskintf.cc index 41ece381c..f9db07088 100644 --- a/src/emc/task/iotaskintf.cc +++ b/src/emc/task/iotaskintf.cc @@ -13,19 +13,19 @@ * Last change: ********************************************************************/ -#include "rtapi_math.h" // fabs() +#include // fabs() #include // DBL_MAX #include // memcpy() strncpy() #include // malloc() -#include "rcs.hh" // RCS_CMD_CHANNEL, etc. -#include "rcs_print.hh" -#include "timer.hh" // esleep, etc. -#include "emc.hh" // EMC NML -#include "emc_nml.hh" -#include "emcglb.h" // EMC_INIFILE +#include // RCS_CMD_CHANNEL, etc. +#include +#include // esleep, etc. +#include // EMC NML +#include +#include // EMC_INIFILE -#include "initool.hh" +#include // IO INTERFACE diff --git a/src/emc/task/taskclass.cc b/src/emc/task/taskclass.cc index d2ebe2d2c..d88aea005 100644 --- a/src/emc/task/taskclass.cc +++ b/src/emc/task/taskclass.cc @@ -18,22 +18,22 @@ * Last change: ********************************************************************/ -#include "rtapi_math.h" // fabs() +#include // fabs() #include // DBL_MAX #include // memcpy() strncpy() #include // malloc() #include -#include "rcs.hh" // RCS_CMD_CHANNEL, etc. -#include "rcs_print.hh" -#include "timer.hh" // esleep, etc. -#include "emc.hh" // EMC NML -#include "emc_nml.hh" -#include "emcglb.h" // EMC_INIFILE +#include // RCS_CMD_CHANNEL, etc. +#include +#include // esleep, etc. +#include // EMC NML +#include +#include // EMC_INIFILE -#include "initool.hh" +#include -#include "python_plugin.hh" +#include #include "taskclass.hh" // Python plugin interface diff --git a/src/emc/task/taskclass.hh b/src/emc/task/taskclass.hh index 4db18d2aa..714518a63 100644 --- a/src/emc/task/taskclass.hh +++ b/src/emc/task/taskclass.hh @@ -1,10 +1,10 @@ #ifndef TASKCLASS_HH #define TASKCLASS_HH -#include "emc.hh" -#include "initool.hh" -#include "tool_parse.h" -#include "inifile.hh" +#include +#include +#include +#include class Task { public: diff --git a/src/emc/task/taskintf.cc b/src/emc/task/taskintf.cc index 296596fca..a5341cb7b 100644 --- a/src/emc/task/taskintf.cc +++ b/src/emc/task/taskintf.cc @@ -12,24 +12,24 @@ * ********************************************************************/ -#include "rtapi_math.h" // isnan() +#include // isnan() #include // DBL_MAX #include // memcpy() strncpy() #include // unlink() -#include "usrmotintf.h" // usrmotInit(), usrmotReadEmcmotStatus(), +#include // usrmotInit(), usrmotReadEmcmotStatus(), // etc. -#include "motion.h" // emcmot_command_t,STATUS, etc. -#include "motion_debug.h" -#include "emc.hh" -#include "emcglb.h" // EMC_INIFILE -#include "emc_nml.hh" -#include "rcs_print.hh" -#include "timer.hh" -#include "inifile.hh" -#include "iniaxis.hh" -#include "initraj.hh" -#include "inihal.hh" +#include // emcmot_command_t,STATUS, etc. +#include +#include +#include // EMC_INIFILE +#include +#include +#include +#include +#include +#include +#include value_inihal_data old_inihal_data; diff --git a/src/emc/task/taskmodule.cc b/src/emc/task/taskmodule.cc index 9b77c7c49..e3c00d675 100644 --- a/src/emc/task/taskmodule.cc +++ b/src/emc/task/taskmodule.cc @@ -5,23 +5,23 @@ #include #include -#include "rs274ngc.hh" -#include "interp_internal.hh" +#include +#include #include "taskclass.hh" -#include "initool.hh" -#include "emcglb.h" // EMC_INIFILE +#include +#include // EMC_INIFILE namespace bp = boost::python; -#include "array1.hh" +#include namespace pp = pyplusplus::containers::static_sized; -#include "interp_array_types.hh" // import activeMCodes,activeGCodes,activeSettings, toolTable +#include // import activeMCodes,activeGCodes,activeSettings, toolTable -#include "rcs.hh" // NML classes, nmlErrorFormat() -#include "emc.hh" // EMC NML -#include "emc_nml.hh" +#include // NML classes, nmlErrorFormat() +#include // EMC NML +#include extern void emctask_quit(int sig); extern EMC_STAT *emcStatus; diff --git a/src/emc/toolstore/CMakeLists.txt b/src/emc/toolstore/CMakeLists.txt new file mode 100644 index 000000000..46447ff75 --- /dev/null +++ b/src/emc/toolstore/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 2.8) +set (project toolstore) + +add_subdirectory(sql) diff --git a/src/emc/toolstore/sql/CMakeLists.txt b/src/emc/toolstore/sql/CMakeLists.txt new file mode 100644 index 000000000..173ec5eb3 --- /dev/null +++ b/src/emc/toolstore/sql/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8) +set (project toolstore/sql) + diff --git a/src/emc/tp/CMakeLists.txt b/src/emc/tp/CMakeLists.txt new file mode 100644 index 000000000..99c837b67 --- /dev/null +++ b/src/emc/tp/CMakeLists.txt @@ -0,0 +1,30 @@ +cmake_minimum_required(VERSION 3.13) +set (project tp) + +set(${project}_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/tpmain.c + ${CMAKE_CURRENT_SOURCE_DIR}/spherical_arc.c + ${CMAKE_CURRENT_SOURCE_DIR}/blendmath.c + ${CMAKE_CURRENT_SOURCE_DIR}/tcq.c + ${CMAKE_CURRENT_SOURCE_DIR}/tc.c + ${CMAKE_CURRENT_SOURCE_DIR}/tp.c +) + +set(${project}_HEADERS + ${CMAKE_CURRENT_SOURCE_DIR}/tc.h + ${CMAKE_CURRENT_SOURCE_DIR}/tp_debug.h + ${CMAKE_CURRENT_SOURCE_DIR}/tcq.h + ${CMAKE_CURRENT_SOURCE_DIR}/tp_types.h + ${CMAKE_CURRENT_SOURCE_DIR}/tp.h + ${CMAKE_CURRENT_SOURCE_DIR}/spherical_arc.h + ${CMAKE_CURRENT_SOURCE_DIR}/blendmath.h + ${CMAKE_CURRENT_SOURCE_DIR}/tc_types.h + ${CMAKE_CURRENT_SOURCE_DIR}/tp_private.h + ${CMAKE_CURRENT_SOURCE_DIR}/tp_shared.h +) + +include_directories(../) +include_directories(${KERNELHEADERS_INCLUDE_DIRS}) + +#add_library(${project} OBJECT ${${project}_SOURCES} ${${project}_HEADERS} ) +#target_compile_options(${project} PUBLIC) diff --git a/src/emc/tp/blendmath.c b/src/emc/tp/blendmath.c index e5c78cf10..56769613d 100644 --- a/src/emc/tp/blendmath.c +++ b/src/emc/tp/blendmath.c @@ -11,11 +11,12 @@ * Last change: ********************************************************************/ -#include "posemath.h" +#include // for 'true' and 'false' +#include #include "tc_types.h" #include "tc.h" #include "tp_types.h" -#include "rtapi_math.h" +#include #include "spherical_arc.h" #include "blendmath.h" #include "tp_debug.h" diff --git a/src/emc/tp/blendmath.h b/src/emc/tp/blendmath.h index 7f6e1cf87..666f6c3b9 100644 --- a/src/emc/tp/blendmath.h +++ b/src/emc/tp/blendmath.h @@ -13,7 +13,7 @@ #ifndef BLENDMATH_H #define BLENDMATH_H -#include "posemath.h" +#include #include "tc_types.h" #define BLEND_ACC_RATIO_TANGENTIAL 0.5 diff --git a/src/emc/tp/hal.h b/src/emc/tp/hal.h deleted file mode 120000 index 04798acf6..000000000 --- a/src/emc/tp/hal.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/hal.h \ No newline at end of file diff --git a/src/emc/tp/hal_types.h b/src/emc/tp/hal_types.h deleted file mode 120000 index 9caade8cc..000000000 --- a/src/emc/tp/hal_types.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/hal_types.h \ No newline at end of file diff --git a/src/emc/tp/rtapi.h b/src/emc/tp/rtapi.h deleted file mode 120000 index 19ace0fa7..000000000 --- a/src/emc/tp/rtapi.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi.h \ No newline at end of file diff --git a/src/emc/tp/rtapi_app.h b/src/emc/tp/rtapi_app.h deleted file mode 120000 index 44c07b6c3..000000000 --- a/src/emc/tp/rtapi_app.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_app.h \ No newline at end of file diff --git a/src/emc/tp/rtapi_errno.h b/src/emc/tp/rtapi_errno.h deleted file mode 120000 index a7c499fbe..000000000 --- a/src/emc/tp/rtapi_errno.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_errno.h \ No newline at end of file diff --git a/src/emc/tp/rtapi_exception.h b/src/emc/tp/rtapi_exception.h deleted file mode 120000 index b36191755..000000000 --- a/src/emc/tp/rtapi_exception.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_exception.h \ No newline at end of file diff --git a/src/emc/tp/rtapi_global.h b/src/emc/tp/rtapi_global.h deleted file mode 120000 index 6dd28b7aa..000000000 --- a/src/emc/tp/rtapi_global.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_global.h \ No newline at end of file diff --git a/src/emc/tp/rtapi_heap.h b/src/emc/tp/rtapi_heap.h deleted file mode 120000 index c43e557ad..000000000 --- a/src/emc/tp/rtapi_heap.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_heap.h \ No newline at end of file diff --git a/src/emc/tp/rtapi_heap_private.h b/src/emc/tp/rtapi_heap_private.h deleted file mode 120000 index 09d0c0749..000000000 --- a/src/emc/tp/rtapi_heap_private.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_heap_private.h \ No newline at end of file diff --git a/src/emc/tp/rtapi_limits.h b/src/emc/tp/rtapi_limits.h deleted file mode 120000 index d08ccf37e..000000000 --- a/src/emc/tp/rtapi_limits.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_limits.h \ No newline at end of file diff --git a/src/emc/tp/rtapi_math.h b/src/emc/tp/rtapi_math.h deleted file mode 120000 index cdb837d6c..000000000 --- a/src/emc/tp/rtapi_math.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_math.h \ No newline at end of file diff --git a/src/emc/tp/spherical_arc.c b/src/emc/tp/spherical_arc.c index 3d1721061..fbd4e2e71 100644 --- a/src/emc/tp/spherical_arc.c +++ b/src/emc/tp/spherical_arc.c @@ -11,10 +11,10 @@ * ********************************************************************/ -#include "posemath.h" +#include #include "spherical_arc.h" #include "tp_types.h" -#include "rtapi_math.h" +#include #include "tp_debug.h" diff --git a/src/emc/tp/spherical_arc.h b/src/emc/tp/spherical_arc.h index cea336909..2c6d6a43e 100644 --- a/src/emc/tp/spherical_arc.h +++ b/src/emc/tp/spherical_arc.h @@ -13,7 +13,7 @@ #ifndef SPHERICAL_ARC_H #define SPHERICAL_ARC_H -#include "posemath.h" +#include #define ARC_POS_EPSILON 1e-12 #define ARC_MIN_RADIUS 1e-12 diff --git a/src/emc/tp/tc.c b/src/emc/tp/tc.c index d37c0003b..d2e7579e7 100644 --- a/src/emc/tp/tc.c +++ b/src/emc/tp/tc.c @@ -14,15 +14,16 @@ * Last change: ********************************************************************/ -#include "rtapi.h" /* rtapi_print_msg */ -#include "rtapi_math.h" -#include "posemath.h" +#include // for 'true' and 'false' +#include /* rtapi_print_msg */ +#include +#include #include "blendmath.h" -#include "emcpose.h" +#include #include "tc.h" #include "tp_types.h" #include "spherical_arc.h" -#include "motion_types.h" +#include //Debug output #include "tp_debug.h" diff --git a/src/emc/tp/tc.h b/src/emc/tp/tc.h index 83036ea4f..1dfca9ba1 100644 --- a/src/emc/tp/tc.h +++ b/src/emc/tp/tc.h @@ -16,8 +16,8 @@ #define TC_H #include "spherical_arc.h" -#include "posemath.h" -#include "emcpos.h" +#include +#include #include "tc_types.h" #include "tp_types.h" diff --git a/src/emc/tp/tc_types.h b/src/emc/tp/tc_types.h index 98e98e651..c62f25dc4 100644 --- a/src/emc/tp/tc_types.h +++ b/src/emc/tp/tc_types.h @@ -16,11 +16,11 @@ #define TC_TYPES_H #include "spherical_arc.h" -#include "posemath.h" -#include "emcpos.h" -#include "emcmotcfg.h" // EMCMOT_MAX_DIO, EMCMOT_MAX_AIO -#include "state_tag.h" -#include "rtapi_bitops.h" +#include +#include +#include // EMCMOT_MAX_DIO, EMCMOT_MAX_AIO +#include +#include #define BLEND_DIST_FRACTION 0.5 /* values for endFlag */ diff --git a/src/emc/tp/tp.c b/src/emc/tp/tp.c index 71d99090c..73e1b467c 100644 --- a/src/emc/tp/tp.c +++ b/src/emc/tp/tp.c @@ -10,18 +10,18 @@ * * Copyright (c) 2004 All rights reserved. ********************************************************************/ -#include "rtapi.h" /* rtapi_print_msg */ -#include "posemath.h" /* Geometry types & functions */ +#include /* rtapi_print_msg */ +#include /* Geometry types & functions */ #include "tc.h" #include "tp.h" #include "tp_private.h" #include "tp_shared.h" -#include "emcpose.h" -#include "rtapi_math.h" +#include +#include // #include "mot_priv.h" //#include "motion_debug.h" -#include "motion_types.h" -#include "motion_id.h" +#include +#include #include "spherical_arc.h" #include "blendmath.h" diff --git a/src/emc/tp/tp.h b/src/emc/tp/tp.h index 68138d4c8..a89555c79 100644 --- a/src/emc/tp/tp.h +++ b/src/emc/tp/tp.h @@ -14,7 +14,7 @@ #ifndef TP_H #define TP_H -#include "posemath.h" +#include #include "tc_types.h" #include "tp_types.h" #include "tcq.h" diff --git a/src/emc/tp/tp_private.h b/src/emc/tp/tp_private.h index b6e1b07c2..8b4009602 100644 --- a/src/emc/tp/tp_private.h +++ b/src/emc/tp/tp_private.h @@ -5,7 +5,7 @@ #ifndef TP_PRIVATE_H #define TP_PRIVATE_H -#include "posemath.h" +#include #include "tc_types.h" #include "tp_types.h" #include "tcq.h" diff --git a/src/emc/tp/tp_shared.h b/src/emc/tp/tp_shared.h index fdaca3d31..c10d8e2df 100644 --- a/src/emc/tp/tp_shared.h +++ b/src/emc/tp/tp_shared.h @@ -1,9 +1,9 @@ #ifndef _TP_SHARED_H #define _TP_SHARED_H -#include "hal.h" -#include "rtapi_math.h" -#include "emcpose.h" +#include +#include +#include typedef void (*emcmotDioWrite_t)(unsigned int index, hal_bit_t value); typedef void (*emcmotAioWrite_t)(unsigned int index, hal_float_t value); diff --git a/src/emc/tp/tp_types.h b/src/emc/tp/tp_types.h index 29e1f1e34..7ac785758 100644 --- a/src/emc/tp/tp_types.h +++ b/src/emc/tp/tp_types.h @@ -14,8 +14,8 @@ #ifndef TP_TYPES_H #define TP_TYPES_H -#include "config.h" -#include "posemath.h" +#include +#include #include "tc_types.h" #include "tcq.h" diff --git a/src/emc/tp/tpmain.c b/src/emc/tp/tpmain.c index d635e72fa..fa5f4fa99 100644 --- a/src/emc/tp/tpmain.c +++ b/src/emc/tp/tpmain.c @@ -1,7 +1,7 @@ -#include "rtapi.h" /* RTAPI realtime OS API */ -#include "rtapi_app.h" /* RTAPI realtime module decls */ -#include "hal.h" -#include "vtable.h" +#include /* RTAPI realtime OS API */ +#include /* RTAPI realtime module decls */ +#include +#include #include "tp.h" #include "tp_private.h" diff --git a/src/emc/tp/vtable.h b/src/emc/tp/vtable.h deleted file mode 120000 index 8733133c0..000000000 --- a/src/emc/tp/vtable.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/vtable.h \ No newline at end of file diff --git a/src/emc/usr_intf/CMakeLists.txt b/src/emc/usr_intf/CMakeLists.txt new file mode 100644 index 000000000..642c83bfb --- /dev/null +++ b/src/emc/usr_intf/CMakeLists.txt @@ -0,0 +1,113 @@ +cmake_minimum_required(VERSION 3.13) +set (project usr_intf) + +if (WITH_RUN_IN_PLACE) + add_definitions(-D__DIR__=${EMC2_HOME}) +else() + add_definitions(-D__DIR__="/var/cache/linuxcnc") +endif() + +set(${project}_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/emcsched.cc + ${CMAKE_CURRENT_SOURCE_DIR}/schedrmt.cc + ${CMAKE_CURRENT_SOURCE_DIR}/emcsh.cc + ${CMAKE_CURRENT_SOURCE_DIR}/emclcd.cc + ${CMAKE_CURRENT_SOURCE_DIR}/emcrsh.cc + ${CMAKE_CURRENT_SOURCE_DIR}/keystick.cc + ${CMAKE_CURRENT_SOURCE_DIR}/xemc.cc + ${CMAKE_CURRENT_SOURCE_DIR}/sockets.c + ${CMAKE_CURRENT_SOURCE_DIR}/emcweb.cc + ${CMAKE_CURRENT_SOURCE_DIR}/emccontroller.cc + ${CMAKE_CURRENT_SOURCE_DIR}/shcom.cc +) + +set(${project}_HEADERS + ${CMAKE_CURRENT_SOURCE_DIR}/emcsched.hh + ${CMAKE_CURRENT_SOURCE_DIR}/shcom.hh + ${CMAKE_CURRENT_SOURCE_DIR}/emccontroller.hh + ${CMAKE_CURRENT_SOURCE_DIR}/sockets.h + ${CMAKE_CURRENT_SOURCE_DIR}/emcweb/singleton.hh + ${CMAKE_CURRENT_SOURCE_DIR}/emcweb/mongoose.h + ${CMAKE_CURRENT_SOURCE_DIR}/emcweb/mongoose_wrapper.hh +) + + +add_subdirectory(axis) +add_subdirectory(gmoccapy) +add_subdirectory(pncconf) +add_subdirectory(emcweb) +add_subdirectory(touchy) +add_subdirectory(gremlin) +add_subdirectory(stepconf) +add_subdirectory(gscreen) + +include_directories(../) +include_directories(${TCL_INCLUDE_PATH}) +include_directories(${TK_INCLUDE_PATH}) + +set(EMCRSH_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/emcrsh.cc + ${CMAKE_CURRENT_SOURCE_DIR}/shcom.cc +) + +set(EMCSCHED_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/schedrmt.cc + ${CMAKE_CURRENT_SOURCE_DIR}/emcsched.cc + ${CMAKE_CURRENT_SOURCE_DIR}/shcom.cc +) + +set(EMCLCD_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/emclcd.cc + ${CMAKE_CURRENT_SOURCE_DIR}/shcom.cc + ${CMAKE_CURRENT_SOURCE_DIR}/sockets.c +) + +if(XINERAMA_FOUND) + set(EMCSH_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/emcsh.cc + ${CMAKE_CURRENT_SOURCE_DIR}/shcom.cc + ) + + add_library(tclmk SHARED ${EMCSH_SOURCES} ${${project}_HEADERS} ) + target_link_libraries(tclmk ${XINERAMA_LIBRARIES}) +endif() + +add_executable(mkcncrsh ${EMCRSH_SOURCES} ${${project}_HEADERS} ) +target_link_libraries(mkcncrsh nml mk mkini Threads::Threads) + +add_executable(schedrmt ${EMCSCHED_SOURCES} ${${project}_HEADERS} ) +target_link_libraries(schedrmt nml mk mkini Threads::Threads) + +add_executable(mkclcd ${EMCLCD_SOURCES} ${${project}_HEADERS} ) +target_link_libraries(mkclcd nml mk mkini) + +if(CURSES_FOUND) + set(KEYSTICK_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/keystick.cc + ) + + add_executable(keystick ${KEYSTICK_SOURCES} ${${project}_HEADERS} ) + target_link_libraries(keystick nml mk mkini ${CURSES_LIBRARIES}) +endif() + +if(HAVE_XAW) + set(XEMC_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/xemc.cc + ) + + add_executable(xmk ${XEMC_SOURCES} ${${project}_HEADERS} ) + target_link_libraries(xmk nml mk mkini ${XAW_LIBRARIES}) +endif() + +if(WITH_EMCWEB) + set(EMCWEB_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/shcom.cc + ${CMAKE_CURRENT_SOURCE_DIR}/emccontroller.cc + ${CMAKE_CURRENT_SOURCE_DIR}/emcweb.cc + ${CMAKE_CURRENT_SOURCE_DIR}/emcweb/mongoose.c + ${CMAKE_CURRENT_SOURCE_DIR}/emcweb/mongoose_wrapper.cc + ) + + add_executable(emcweb ${EMCWEB_SOURCES} ${${project}_HEADERS} ) + target_link_libraries(emcweb nml mk mkini Boost::thread dl) +endif() diff --git a/src/emc/usr_intf/axis/CMakeLists.txt b/src/emc/usr_intf/axis/CMakeLists.txt new file mode 100644 index 000000000..f19519965 --- /dev/null +++ b/src/emc/usr_intf/axis/CMakeLists.txt @@ -0,0 +1,75 @@ +cmake_minimum_required(VERSION 3.12) +set (project axis) + +add_subdirectory(extensions) +add_subdirectory(etc) +add_subdirectory(scripts) + +# PYTARGETS += $(EMCMODULE) $(MINIGLMODULE) $(TOGLMODULE) + +set(AXIS_PY_TARGETS + axis + axis-remote + linuxcnctop + hal_manualtoolchange + mdi + image-to-gcode + lintini + debuglevel + teach-in + tracking-test +) + +# image-to-gcode needs python-pil, numpy + +# Check syntax of targets +foreach(_target ${AXIS_PY_TARGETS}) + add_custom_command( + OUTPUT "${_target}.pyc" + COMMAND ${Python2_Interp} -m py_compile "${CMAKE_CURRENT_SOURCE_DIR}/scripts/${_target}.py" + DEPENDS "${_target}.py" + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) + add_custom_target(${_target} + COMMAND cp "${CMAKE_CURRENT_SOURCE_DIR}/scripts/${_target}.py" "${_target}" + DEPENDS "{_target}.pyc" + VERBATIM + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) +endforeach() + +# Fix target paths and file extentions +list(TRANSFORM AXIS_PY_TARGETS PREPEND "scripts/") +list(TRANSFORM AXIS_PY_TARGETS APPEND ".py") + +install( + FILES ${AXIS_PY_TARGETS} + DESTINATION bin +) + +# TODO - not sure how to handle I18N stuff yet +#PYI18NSRCS += $(addprefix emc/usr_intf/axis/scripts/, $(PYSCRIPTS)) \ +# ../lib/python/propertywindow.py \ +# ../share/axis/tcl/axis.tcl + +include_directories(../../) +include_directories(${TCL_INCLUDE_PATH}) +include_directories(${TK_INCLUDE_PATH}) + +set(EMC_MODULE_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/extensions/emcmodule.cc +) +add_library(emcmodule SHARED ${EMC_MODULE_SOURCES}) +# -lGL + +set(MINIGL_MODULE_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/extensions/minigl.c +) +add_library(minigl SHARED ${MINIGL_MODULE_SOURCES}) +# -lGL -lGLU + +set(TOGL_MODULE_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/extensions/_toglmodule.c +) +add_library(_togl SHARED ${TOGL_MODULE_SOURCES}) +# -lX11 -lGL -lGLU -lXmu $(TCL_LIBS) diff --git a/src/emc/usr_intf/axis/etc/CMakeLists.txt b/src/emc/usr_intf/axis/etc/CMakeLists.txt new file mode 100644 index 000000000..b24dfcb6b --- /dev/null +++ b/src/emc/usr_intf/axis/etc/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8) +set (project etc) + diff --git a/src/emc/usr_intf/axis/extensions/CMakeLists.txt b/src/emc/usr_intf/axis/extensions/CMakeLists.txt new file mode 100644 index 000000000..198e5edd9 --- /dev/null +++ b/src/emc/usr_intf/axis/extensions/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8) +set (project extensions) + +set(${project}_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/togl.c + ${CMAKE_CURRENT_SOURCE_DIR}/minigl.c + ${CMAKE_CURRENT_SOURCE_DIR}/_toglmodule.c + ${CMAKE_CURRENT_SOURCE_DIR}/emcmodule.cc +) + +set(${project}_HEADERS + ${CMAKE_CURRENT_SOURCE_DIR}/togl.h +) + +include_directories(../../../) +include_directories(${TCL_INCLUDE_PATH}) + +add_library(${project} OBJECT ${${project}_SOURCES} ${${project}_HEADERS} ) +target_compile_options(${project} PUBLIC -fPIC) diff --git a/src/emc/usr_intf/axis/extensions/_toglmodule.c b/src/emc/usr_intf/axis/extensions/_toglmodule.c index 6c872b5fe..861ce0691 100644 --- a/src/emc/usr_intf/axis/extensions/_toglmodule.c +++ b/src/emc/usr_intf/axis/extensions/_toglmodule.c @@ -14,7 +14,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include -#include +#include "togl.c" static int first_time = 1; static Tcl_Interp *get_interpreter(PyObject *tkapp) { diff --git a/src/emc/usr_intf/axis/extensions/emcmodule.cc b/src/emc/usr_intf/axis/extensions/emcmodule.cc index 275148e5c..7e9b19eb2 100644 --- a/src/emc/usr_intf/axis/extensions/emcmodule.cc +++ b/src/emc/usr_intf/axis/extensions/emcmodule.cc @@ -20,16 +20,16 @@ #include #include #include -#include "config.h" -#include "rcs.hh" -#include "emc.hh" -#include "emc_nml.hh" -#include "kinematics.h" -#include "config.h" -#include "inifile.hh" -#include "timer.hh" -#include "nml_oi.hh" -#include "rcs_print.hh" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include diff --git a/src/emc/usr_intf/axis/scripts/CMakeLists.txt b/src/emc/usr_intf/axis/scripts/CMakeLists.txt new file mode 100644 index 000000000..c138654cd --- /dev/null +++ b/src/emc/usr_intf/axis/scripts/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8) +set (project scripts) + diff --git a/src/emc/usr_intf/axis/scripts/image-to-gcode.py b/src/emc/usr_intf/axis/scripts/image-to-gcode.py index 03ed65701..8ceb54205 100644 --- a/src/emc/usr_intf/axis/scripts/image-to-gcode.py +++ b/src/emc/usr_intf/axis/scripts/image-to-gcode.py @@ -23,20 +23,25 @@ import gettext; gettext.install("linuxcnc", localedir=os.path.join(BASE, "share", "locale"), unicode=True) -import Image +try: + from PIL import Image +except ImportError: + import Image try: - import numpy.numarray as numarray + from numpy import ndarray as numarray + from numpy import inf import numpy.core olderr = numpy.core.seterr(divide='ignore') - plus_inf = (numarray.array((1.,))/0.)[0] + plus_inf = inf numpy.core.seterr(**olderr) except ImportError: import numarray, numarray.ieeespecial plus_inf = numarray.ieeespecial.inf -from rs274.author import Gcode -import rs274.options +#from rs274.author import Gcode +#import rs274.options +import gcode from math import * import operator diff --git a/src/emc/usr_intf/emccontroller.cc b/src/emc/usr_intf/emccontroller.cc index 09c1264b6..7674da3cd 100644 --- a/src/emc/usr_intf/emccontroller.cc +++ b/src/emc/usr_intf/emccontroller.cc @@ -17,15 +17,15 @@ ********************************************************************/ -#include "rcs.hh" -#include "posemath.h" // PM_POSE, TO_RAD -#include "emc.hh" // EMC NML -#include "canon.hh" // CANON_UNITS, CANON_UNITS_INCHES,MM,CM -#include "emcglb.h" // EMC_NMLFILE, TRAJ_MAX_VELOCITY, etc. -#include "emccfg.h" // DEFAULT_TRAJ_MAX_VELOCITY -#include "inifile.hh" // INIFILE -#include "rcs_print.hh" -#include "timer.hh" // etime() +#include +#include // PM_POSE, TO_RAD +#include // EMC NML +#include // CANON_UNITS, CANON_UNITS_INCHES,MM,CM +#include // EMC_NMLFILE, TRAJ_MAX_VELOCITY, etc. +#include // DEFAULT_TRAJ_MAX_VELOCITY +#include // INIFILE +#include +#include // etime() #include "shcom.hh" // NML Messaging functions #include #include diff --git a/src/emc/usr_intf/emclcd.cc b/src/emc/usr_intf/emclcd.cc index c90b3c78a..2e54f2a62 100644 --- a/src/emc/usr_intf/emclcd.cc +++ b/src/emc/usr_intf/emclcd.cc @@ -38,7 +38,7 @@ #include #include #include -#include "rtapi_math.h" +#include #include #include #include @@ -46,15 +46,15 @@ #include #include -#include "rcs.hh" -#include "posemath.h" // PM_POSE, TO_RAD -#include "emc.hh" // EMC NML -#include "canon.hh" // CANON_UNITS, CANON_UNITS_INCHES,MM,CM -#include "emcglb.h" // EMC_NMLFILE, TRAJ_MAX_VELOCITY, etc. -#include "emccfg.h" // DEFAULT_TRAJ_MAX_VELOCITY -#include "inifile.hh" // INIFILE -#include "config.h" // Standard path definitions -#include "rcs_print.hh" +#include +#include // PM_POSE, TO_RAD +#include // EMC NML +#include // CANON_UNITS, CANON_UNITS_INCHES,MM,CM +#include // EMC_NMLFILE, TRAJ_MAX_VELOCITY, etc. +#include // DEFAULT_TRAJ_MAX_VELOCITY +#include // INIFILE +#include // Standard path definitions +#include #include "sockets.h" // TCP/IP common socket functions #include "shcom.hh" // Common NML messaging routines diff --git a/src/emc/usr_intf/emcrsh.cc b/src/emc/usr_intf/emcrsh.cc index 8b4748690..d4f2a3cd7 100644 --- a/src/emc/usr_intf/emcrsh.cc +++ b/src/emc/usr_intf/emcrsh.cc @@ -14,7 +14,9 @@ * Last change: ********************************************************************/ +#ifndef _REENTRANT #define _REENTRANT +#endif #include #include @@ -22,7 +24,7 @@ #include #include #include -#include "rtapi_math.h" +#include #include #include #include @@ -33,15 +35,15 @@ #include -#include "rcs.hh" -#include "posemath.h" // PM_POSE, TO_RAD -#include "emc.hh" // EMC NML -#include "canon.hh" // CANON_UNITS, CANON_UNITS_INCHES,MM,CM -#include "emcglb.h" // EMC_NMLFILE, TRAJ_MAX_VELOCITY, etc. -#include "emccfg.h" // DEFAULT_TRAJ_MAX_VELOCITY -#include "inifile.hh" // INIFILE -#include "rcs_print.hh" -#include "timer.hh" // etime() +#include +#include // PM_POSE, TO_RAD +#include // EMC NML +#include // CANON_UNITS, CANON_UNITS_INCHES,MM,CM +#include // EMC_NMLFILE, TRAJ_MAX_VELOCITY, etc. +#include // DEFAULT_TRAJ_MAX_VELOCITY +#include // INIFILE +#include +#include // etime() #include "shcom.hh" // NML Messaging functions /* diff --git a/src/emc/usr_intf/emcsched.cc b/src/emc/usr_intf/emcsched.cc index 3d48cb958..81b52b0b7 100644 --- a/src/emc/usr_intf/emcsched.cc +++ b/src/emc/usr_intf/emcsched.cc @@ -20,22 +20,22 @@ #include #include #include -#include "rtapi_math.h" +#include #include #include #include -#include "rcs.hh" -#include "posemath.h" // PM_POSE, TO_RAD -#include "emc.hh" // EMC NML -#include "emc_nml.hh" -#include "canon.hh" // CANON_UNITS, CANON_UNITS_INCHES,MM,CM -#include "emcglb.h" // EMC_NMLFILE, TRAJ_MAX_VELOCITY, etc. -#include "emccfg.h" // DEFAULT_TRAJ_MAX_VELOCITY -#include "inifile.hh" // INIFILE -#include "nml_oi.hh" // nmlErrorFormat, NML_ERROR, etc -#include "rcs_print.hh" -#include "timer.hh" // esleep +#include +#include // PM_POSE, TO_RAD +#include // EMC NML +#include +#include // CANON_UNITS, CANON_UNITS_INCHES,MM,CM +#include // EMC_NMLFILE, TRAJ_MAX_VELOCITY, etc. +#include // DEFAULT_TRAJ_MAX_VELOCITY +#include // INIFILE +#include // nmlErrorFormat, NML_ERROR, etc +#include +#include // esleep #include "shcom.hh" // Common NML communications functions #include "emcsched.hh" // Common scheduling functions diff --git a/src/emc/usr_intf/emcsched.hh b/src/emc/usr_intf/emcsched.hh index ebe0e8d30..593f8e665 100644 --- a/src/emc/usr_intf/emcsched.hh +++ b/src/emc/usr_intf/emcsched.hh @@ -17,8 +17,8 @@ #ifndef EMCSCHED_HH #define EMCSCHED_HH -#include "emc_nml.hh" -#include "nml_oi.hh" // NML_ERROR_LEN +#include +#include // NML_ERROR_LEN #include using namespace std; diff --git a/src/emc/usr_intf/emcsh.cc b/src/emc/usr_intf/emcsh.cc index 823b64d51..f58506eaa 100644 --- a/src/emc/usr_intf/emcsh.cc +++ b/src/emc/usr_intf/emcsh.cc @@ -18,20 +18,20 @@ #include #include #include -#include "rtapi_math.h" +#include #include #include -#include "rcs.hh" -#include "posemath.h" // PM_POSE, TO_RAD -#include "emc.hh" // EMC NML -#include "emc_nml.hh" // EMC NML -#include "canon.hh" // CANON_UNITS, CANON_UNITS_INCHES,MM,CM -#include "emcglb.h" // EMC_NMLFILE, TRAJ_MAX_VELOCITY, etc. -#include "emccfg.h" // DEFAULT_TRAJ_MAX_VELOCITY -#include "inifile.hh" // INIFILE -#include "rcs_print.hh" -#include "timer.hh" +#include +#include // PM_POSE, TO_RAD +#include // EMC NML +#include // EMC NML +#include // CANON_UNITS, CANON_UNITS_INCHES,MM,CM +#include // EMC_NMLFILE, TRAJ_MAX_VELOCITY, etc. +#include // DEFAULT_TRAJ_MAX_VELOCITY +#include // INIFILE +#include +#include #include "shcom.hh" diff --git a/src/emc/usr_intf/emcweb.cc b/src/emc/usr_intf/emcweb.cc index 11444d9cd..a41b8d84d 100644 --- a/src/emc/usr_intf/emcweb.cc +++ b/src/emc/usr_intf/emcweb.cc @@ -21,15 +21,15 @@ #include #include #include -#include "rcs.hh" -#include "posemath.h" // PM_POSE, TO_RAD -#include "emc.hh" // EMC NML -#include "canon.hh" // CANON_UNITS, CANON_UNITS_INCHES,MM,CM -#include "emcglb.h" // EMC_NMLFILE, TRAJ_MAX_VELOCITY, etc. -#include "emccfg.h" // DEFAULT_TRAJ_MAX_VELOCITY -#include "inifile.hh" // INIFILE -#include "rcs_print.hh" -#include "timer.hh" // etime() +#include +#include // PM_POSE, TO_RAD +#include // EMC NML +#include // CANON_UNITS, CANON_UNITS_INCHES,MM,CM +#include // EMC_NMLFILE, TRAJ_MAX_VELOCITY, etc. +#include // DEFAULT_TRAJ_MAX_VELOCITY +#include // INIFILE +#include +#include // etime() #include "shcom.hh" // NML Messaging functions #include "emcweb/mongoose_wrapper.hh" diff --git a/src/emc/usr_intf/emcweb/CMakeLists.txt b/src/emc/usr_intf/emcweb/CMakeLists.txt new file mode 100644 index 000000000..8ca67b0cd --- /dev/null +++ b/src/emc/usr_intf/emcweb/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 2.8) +set (project emcweb) + +set(${project}_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/mongoose_wrapper.cc + ${CMAKE_CURRENT_SOURCE_DIR}/mongoose.c +) + +set(${project}_HEADERS + ${CMAKE_CURRENT_SOURCE_DIR}/singleton.hh + ${CMAKE_CURRENT_SOURCE_DIR}/mongoose.h + ${CMAKE_CURRENT_SOURCE_DIR}/mongoose_wrapper.hh +) + +#add_library(${project} STATIC ${${project}_SOURCES} ${${project}_HEADERS} ) diff --git a/src/emc/usr_intf/gmoccapy/CMakeLists.txt b/src/emc/usr_intf/gmoccapy/CMakeLists.txt new file mode 100644 index 000000000..f72b9a5c3 --- /dev/null +++ b/src/emc/usr_intf/gmoccapy/CMakeLists.txt @@ -0,0 +1,66 @@ +cmake_minimum_required(VERSION 3.13) +set (project gmoccapy) + +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/__init__.py "") + +set(gmoccapy_MODULES + ${CMAKE_CURRENT_SOURCE_DIR}/dialogs + ${CMAKE_CURRENT_SOURCE_DIR}/getiniinfo + ${CMAKE_CURRENT_SOURCE_DIR}/notification + ${CMAKE_CURRENT_SOURCE_DIR}/player + ${CMAKE_CURRENT_SOURCE_DIR}/preferences + ${CMAKE_CURRENT_SOURCE_DIR}/widgets + ${CMAKE_CURRENT_BINARY_DIR}/__init__ +) + +# Check syntax of modules +foreach(module ${gmoccapy_MODULES}) + add_custom_command( + OUTPUT "${module}.pyc" + COMMAND ${Python2_Interp} -m py_compile "${module}.py" + DEPENDS "${module}.py" + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) +endforeach() + +list(TRANSFORM gmoccapy_MODULES APPEND ".py") + +install( + FILES ${gmoccapy_MODULES} + DESTINATION ${Python2_SITELIB}/${project} +) + +# Check syntax of gmoccapy +add_custom_command( + OUTPUT "${project}.pyc" + COMMAND ${Python2_Interp} -m py_compile "${project}.py" + DEPENDS "${project}.py" + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +) + +# Stage gmoccapy executable for installation +add_custom_target(${project} + COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/${project}.py ${project} + DEPENDS ${project}.pyc + VERBATIM + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +) + +install( + FILES "${project}.py" + DESTINATION bin + RENAME ${project} +) + +set(gmoccapy_GLADES + ${CMAKE_CURRENT_SOURCE_DIR}/gmoccapy.glade +) + +install( + FILES ${gmoccapy_GLADES} + DESTINATION share/machinekit +) + +# TODO - not sure how to handle I18N stuff yet +#PYTARGETS += ../bin/gmoccapy ../lib/python/gmoccapy/__init__.py $(patsubst %,../lib/python/gmoccapy/%.py,$(GMOCCAPY_MODULES)) \ +# ../share/gmoccapy/gmoccapy.glade diff --git a/src/emc/usr_intf/gremlin/CMakeLists.txt b/src/emc/usr_intf/gremlin/CMakeLists.txt new file mode 100644 index 000000000..d59089f6a --- /dev/null +++ b/src/emc/usr_intf/gremlin/CMakeLists.txt @@ -0,0 +1,48 @@ +cmake_minimum_required(VERSION 2.8) +set (project gremlin) + +set(gremlin_MODULES + ${CMAKE_CURRENT_SOURCE_DIR}/gremlin +) + +# Check syntax of modules +foreach(module ${gremlin_MODULES}) + add_custom_command( + OUTPUT "${module}.pyc" + COMMAND ${Python2_Interp} -m py_compile "${module}.py" + DEPENDS "${module}.py" + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) +endforeach() + +list(TRANSFORM gremlin_MODULES APPEND ".py") + +install( + FILES ${gremlin_MODULES} + DESTINATION ${Python2_SITELIB}/ +) + +# Check syntax of gremlin-run +add_custom_command( + OUTPUT "${project}-run.pyc" + COMMAND ${Python2_Interp} -m py_compile "${project}-run.py" + DEPENDS "${project}-run.py" + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +) + +# Stage gremlin executable for installation +add_custom_target(${project} + COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/${project}-run.py ${project}-run + DEPENDS ${project}-run.pyc + VERBATIM + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +) + +install( + FILES ${project}-run + DESTINATION bin +) + +# TODO - not sure how to handle I18N stuff yet +#PYI18NSRCS += emc/usr_intf/gremlin/gremlin.py + diff --git a/src/emc/usr_intf/gscreen/CMakeLists.txt b/src/emc/usr_intf/gscreen/CMakeLists.txt new file mode 100644 index 000000000..19d68a71e --- /dev/null +++ b/src/emc/usr_intf/gscreen/CMakeLists.txt @@ -0,0 +1,67 @@ +cmake_minimum_required(VERSION 2.8) +set (project gscreen) + +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/__init__.py "") + +set(gscreen_MODULES + ${CMAKE_CURRENT_SOURCE_DIR}/mdi + ${CMAKE_CURRENT_SOURCE_DIR}/emc_interface + ${CMAKE_CURRENT_SOURCE_DIR}/preferences + ${CMAKE_CURRENT_SOURCE_DIR}/keybindings + ${CMAKE_CURRENT_BINARY_DIR}/__init__ +) + +# Check syntax of modules +foreach(module ${gscreen_MODULES}) + add_custom_command( + OUTPUT "${module}.pyc" + COMMAND ${Python2_Interp} -m py_compile "${module}.py" + DEPENDS "${module}.py" + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) +endforeach() + +list(TRANSFORM gscreen_MODULES APPEND ".py") + +install( + FILES ${gscreen_MODULES} + DESTINATION ${Python2_SITELIB}/${project} +) + +# Check syntax of gscreen +add_custom_command( + OUTPUT "${project}.pyc" + COMMAND ${Python2_Interp} -m py_compile "${project}.py" + DEPENDS "${project}.py" + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +) + +# Stage gscreen executable for installation +add_custom_target(${project} + COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/${project}.py ${project} + DEPENDS ${project}.pyc + VERBATIM + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +) + +install( + FILES "${project}.py" + DESTINATION bin + RENAME ${project} +) + +set(gscreen_GLADES + ${CMAKE_CURRENT_SOURCE_DIR}/gscreen.glade + ${CMAKE_CURRENT_SOURCE_DIR}/gscreen2.glade +) + +install( + FILES ${gscreen_GLADES} + DESTINATION share/machinekit +) + +# TODO - not sure how to handle I18N stuff yet +#PYI18NSRCS += emc/usr_intf/gscreen/gscreen.py $(patsubst %,emc/usr_intf/gscreen/%.py,$(GSCREEN_MODULES)) \ +# emc/usr_intf/gscreen/gscreen.glade \ +# emc/usr_intf/gscreen/gscreen2.glade + diff --git a/src/emc/usr_intf/hal.h b/src/emc/usr_intf/hal.h deleted file mode 120000 index 04798acf6..000000000 --- a/src/emc/usr_intf/hal.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/hal.h \ No newline at end of file diff --git a/src/emc/usr_intf/hal_types.h b/src/emc/usr_intf/hal_types.h deleted file mode 120000 index 9caade8cc..000000000 --- a/src/emc/usr_intf/hal_types.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/hal_types.h \ No newline at end of file diff --git a/src/emc/usr_intf/halui.cc b/src/emc/usr_intf/halui.cc deleted file mode 100644 index d35d13d03..000000000 --- a/src/emc/usr_intf/halui.cc +++ /dev/null @@ -1,2264 +0,0 @@ -/******************************************************************** -* Description: halui.cc -* HAL User-Interface component. -* This file exports various UI related hal pins, and communicates -* with EMC through NML messages -* -* Derived from a work by Fred Proctor & Will Shackleford (emcsh.cc) -* some of the functions (sendFooBar() are adapted from there) -* -* Author: Alex Joni -* License: GPL Version 2 -* System: Linux -* -* Copyright (c) 2006 All rights reserved. -* -* Last change: -********************************************************************/ - -#include -#include -#include -#include -#include "rtapi_math.h" - -#include "hal.h" /* access to HAL functions/definitions */ -#include "rtapi.h" /* rtapi_print_msg */ -#include "rcs.hh" -#include "posemath.h" // PM_POSE, TO_RAD -#include "emc.hh" // EMC NML -#include "emc_nml.hh" -#include "emcglb.h" // EMC_NMLFILE, TRAJ_MAX_VELOCITY, etc. -#include "emccfg.h" // DEFAULT_TRAJ_MAX_VELOCITY -#include "inifile.hh" // INIFILE -#include "rcs_print.hh" -#include "nml_oi.hh" -#include "timer.hh" - -/* - Using halui: - - halui {-ini } - - With -ini , uses inifile instead of emc.ini. - - Once executed, it connects to NML buffers, exports various HAL pins - and communicates changes to EMC. It also sets certain HAL pins based - on status values. - - - Naming: - - All pins will be named after the following scheme: - - halui.name..action - - name refers to the name of the component, - currently one of: - - machine - - estop - - mode - - mist - - flood - - lube - - jog - - program - - probe - ... - - if more than one component of the same type exists - - action usually on/off or is-on for the status (this uses the NIST way of - control, each action is done by momentary pushbuttons, and thus - more than one source of control is allowed: e.g. multiple UI's, - GUI's ) - - Exported pins: - -DONE: - machine: - halui.machine.on bit //pin for setting machine On - halui.machine.off bit //pin for setting machine Off - halui.machine.is-on bit //pin for machine is On/Off - -DONE: - estop: - halui.estop.activate bit //pin for setting Estop (emc internal) On - halui.estop.reset bit //pin for resetting Estop (emc internal) Off - halui.estop.is-activated bit //pin for displaying Estop state (emc internal) On/Off - -DONE: - mode: - halui.mode.manual bit //pin for requesting manual mode - halui.mode.is_manual bit //pin for manual mode is on - halui.mode.auto bit //pin for requesting auto mode - halui.mode.is_auto bit //pin for auto mode is on - halui.mode.mdi bit //pin for requesting mdi mode - halui.mode.is_mdi bit //pin for mdi mode is on - halui.mode.teleop bit //pin for requesting teleop mode - halui.mode.is_teleop bit //pin for teleop mode is on - halui.mode.joint bit //pin for requesting joint mode - halui.mode.is_joint bit //pin for joint mode is on - -DONE: - mist, flood, lube: - halui.mist.on bit //pin for starting mist - halui.mist.off bit //pin for stoping mist - halui.mist.is-on bit //pin for mist is on - halui.flood.on bit //pin for starting flood - halui.flood.off bit //pin for stoping flood - halui.flood.is-on bit //pin for flood is on - halui.lube.on bit //pin for starting lube - halui.lube.off bit //pin for stoping lube - halui.lube.is-on bit //pin for lube is on - -DONE: - spindle: - halui.spindle.start bit - halui.spindle.stop bit - halui.spindle.forward bit - halui.spindle.reverse bit - halui.spindle.increase bit - halui.spindle.decrease bit - - halui.spindle.brake-on bit //pin for activating spindle-brake - halui.spindle.brake-off bit //pin for deactivating spindle/brake - halui.spindle.brake-is-on bit //status pin that tells us if brake is on - -DONE: - joint: - halui.joint.0.home bit // pin for homing the specific joint - halui.joint.0.unhome bit // pin for unhoming the specific joint - halui.joint.0.is-homed bit // status pin telling that the joint is homed - .. - halui.joint.8.home bit - halui.joint.8.is-homed bit - - halui.joint.selected.home bit // pin for homing the selected joint - halui.joint.selected.unhome bit // pin for unhoming the selected joint - halui.joint.selected.is-homed bit // status pin telling that the selected joint is homed - - halui.joint.x.on-soft-min-limit bit - halui.joint.x.on-soft-max-limit bit - halui.joint.x.on-hard-min-limit bit - halui.joint.x.on-hard-max-limit bit - (x = 0..8, selected) - - halui.joint.x.has-fault bit - (x = 0..8, selected) - - halui.joint.select u8 // select joint (0..7) - internal halui - halui.joint.selected u8 // selected joint (0..7) - internal halui - halui.joint.x.select bit // pins for selecting a joint - internal halui - halui.joint.x.is-selected bit // status pin - internal halui - -WIP: - halui.axis.0.pos-commanded float //cartesian position, commanded - halui.axis.0.pos-feedback float //cartesian position, actual - halui.axis.0.pos-relative float //cartesian position, relative - ... - -DONE - jogging: - halui.jog-speed float //set jog speed - halui.jog-deadband float //pin for setting the jog analog deadband (where not to move) - - halui.jog.0.minus bit - halui.jog.0.plus bit - halui.jog.0.analog float //pin for jogging the axis 0 - halui.jog.0.increment float - halui.jog.0.increment-plus bit - halui.jog.0.increment-minus bit - .. - halui.jog.7.minus bit - halui.jog.7.plus bit - halui.jog.7.analog float //pin for jogging the axis 7 - halui.jog.7.increment float - halui.jog.7.increment-plus bit - halui.jog.7.increment-minus bit - halui.jog.selected.minus bit - halui.jog.selected.plus bit - halui.jog.selected.increment float - halui.jog.selected.increment-plus bit - halui.jog.selected.increment-minus bit - -DONE - tool: - halui.tool.number u32 //current selected tool - halui.tool.length-offset float //current applied tool-length-offset - -DONE: - program: - halui.program.is-idle bit - halui.program.is-running bit - halui.program.is-paused bit - halui.program.run bit - halui.program.pause bit - halui.program.resume bit - halui.program.step bit - halui.program.stop bit - -DONE: - general: - halui.home-all bit // pin to send a sequenced home all joints message - halui.abort bit // pin to send an abort message (clears out most errors, stops running programs, etc) - -DONE: - max-velocity-override - halui.max-velocity-override.value float //current MV value - halui.max-velocity-override.scale float // pin for setting the scale on changing the MV - halui.max-velocity-override.counts s32 //counts from an encoder for example to change MV - halui.max-velocity-override.count-enable bit // TRUE to modify MV based on counts - halui.max-velocity-override.increase bit // pin for increasing the MV (+=scale) - halui.max-velocity-override.direct-value bit // TRUE to make override based as a direct (scaled) value rather then counts of increments - halui.max-velocity-override.decrease bit // pin for decreasing the MV (-=scale) - -DONE: - feed-override - halui.feed-override.value float //current FO value - halui.feed-override.scale float // pin for setting the scale on changing the FO - halui.feed-override.counts s32 //counts from an encoder for example to change FO - halui.feed-override.count-enable bit // TRUE to modify FO based on counts - halui.feed-override.direct-value bit // TRUE to make override based as a direct (scaled) value rather then counts of increments - halui.feed-override.increase bit // pin for increasing the FO (+=scale) - halui.feed-override.decrease bit // pin for decreasing the FO (-=scale) - -DONE: - spindle-override - halui.spindle-override.value float //current FO value - halui.spindle-override.scale float // pin for setting the scale on changing the SO - halui.spindle-override.counts s32 //counts from an encoder for example to change SO - halui.spindle-override.count-enable bit // TRUE to modify SO based on counts - halui.spindle-override.direct-value bit // TRUE to make override based as a direct (scaled) value rather then counts of increments - halui.spindle-override.increase bit // pin for increasing the SO (+=scale) - halui.spindle-override.decrease bit // pin for decreasing the SO (-=scale) - -*/ - -#define MDI_MAX 64 - -#pragma GCC diagnostic push -#if defined(__GNUC__) && (__GNUC__ > 4) -#pragma GCC diagnostic ignored "-Wignored-attributes" -#endif - -#define HAL_FIELDS \ - FIELD(hal_bit_t,machine_on) /* pin for setting machine On */ \ - FIELD(hal_bit_t,machine_off) /* pin for setting machine Off */ \ - FIELD(hal_bit_t,machine_is_on) /* pin for machine is On/Off */ \ - FIELD(hal_bit_t,estop_activate) /* pin for activating EMC ESTOP */ \ - FIELD(hal_bit_t,estop_reset) /* pin for resetting ESTOP */ \ - FIELD(hal_bit_t,estop_is_activated) /* pin for status ESTOP is activated */ \ -\ - FIELD(hal_bit_t,mode_manual) /* pin for requesting manual mode */ \ - FIELD(hal_bit_t,mode_is_manual) /* pin for manual mode is on */ \ - FIELD(hal_bit_t,mode_auto) /* pin for requesting auto mode */ \ - FIELD(hal_bit_t,mode_is_auto) /* pin for auto mode is on */ \ - FIELD(hal_bit_t,mode_mdi) /* pin for requesting mdi mode */ \ - FIELD(hal_bit_t,mode_is_mdi) /* pin for mdi mode is on */ \ - FIELD(hal_bit_t,mode_teleop) /* pin for requesting teleop mode */ \ - FIELD(hal_bit_t,mode_is_teleop) /* pin for teleop mode is on */ \ - FIELD(hal_bit_t,mode_joint) /* pin for requesting joint mode */ \ - FIELD(hal_bit_t,mode_is_joint) /* pin for joint mode is on */ \ -\ - FIELD(hal_bit_t,mist_on) /* pin for starting mist */ \ - FIELD(hal_bit_t,mist_off) /* pin for stoping mist */ \ - FIELD(hal_bit_t,mist_is_on) /* pin for mist is on */ \ - FIELD(hal_bit_t,flood_on) /* pin for starting flood */ \ - FIELD(hal_bit_t,flood_off) /* pin for stoping flood */ \ - FIELD(hal_bit_t,flood_is_on) /* pin for flood is on */ \ - FIELD(hal_bit_t,lube_on) /* pin for starting lube */ \ - FIELD(hal_bit_t,lube_off) /* pin for stoping lube */ \ - FIELD(hal_bit_t,lube_is_on) /* pin for lube is on */ \ -\ - FIELD(hal_bit_t,program_is_idle) /* pin for notifying user that program is idle */ \ - FIELD(hal_bit_t,program_is_running) /* pin for notifying user that program is running */ \ - FIELD(hal_bit_t,program_is_paused) /* pin for notifying user that program is paused */ \ - FIELD(hal_bit_t,program_run) /* pin for running program */ \ - FIELD(hal_bit_t,program_pause) /* pin for pausing program */ \ - FIELD(hal_bit_t,program_resume) /* pin for resuming program */ \ - FIELD(hal_bit_t,program_step) /* pin for running one line of the program */ \ - FIELD(hal_bit_t,program_stop) /* pin for stopping the program */ \ - FIELD(hal_bit_t,program_os_on) /* pin for setting optional stop on */ \ - FIELD(hal_bit_t,program_os_off) /* pin for setting optional stop off */ \ - FIELD(hal_bit_t,program_os_is_on) /* status pin that optional stop is on */ \ - FIELD(hal_bit_t,program_bd_on) /* pin for setting block delete on */ \ - FIELD(hal_bit_t,program_bd_off) /* pin for setting block delete off */ \ - FIELD(hal_bit_t,program_bd_is_on) /* status pin that block delete is on */ \ -\ - FIELD(hal_u32_t,tool_number) /* pin for current selected tool */ \ - FIELD(hal_float_t,tool_length_offset_x) /* current applied x tool-length-offset */ \ - FIELD(hal_float_t,tool_length_offset_y) /* current applied y tool-length-offset */ \ - FIELD(hal_float_t,tool_length_offset_z) /* current applied z tool-length-offset */ \ - FIELD(hal_float_t,tool_length_offset_a) /* current applied a tool-length-offset */ \ - FIELD(hal_float_t,tool_length_offset_b) /* current applied b tool-length-offset */ \ - FIELD(hal_float_t,tool_length_offset_c) /* current applied c tool-length-offset */ \ - FIELD(hal_float_t,tool_length_offset_u) /* current applied u tool-length-offset */ \ - FIELD(hal_float_t,tool_length_offset_v) /* current applied v tool-length-offset */ \ - FIELD(hal_float_t,tool_length_offset_w) /* current applied w tool-length-offset */ \ -\ - FIELD(hal_bit_t,spindle_start) /* pin for starting the spindle */ \ - FIELD(hal_bit_t,spindle_stop) /* pin for stoping the spindle */ \ - FIELD(hal_bit_t,spindle_is_on) /* status pin for spindle is on */ \ - FIELD(hal_bit_t,spindle_forward) /* pin for making the spindle go forward */ \ - FIELD(hal_bit_t,spindle_runs_forward) /* status pin for spindle running forward */ \ - FIELD(hal_bit_t,spindle_reverse) /* pin for making the spindle go reverse */ \ - FIELD(hal_bit_t,spindle_runs_backward) /* status pin for spindle running backward */ \ - FIELD(hal_bit_t,spindle_increase) /* pin for making the spindle go faster */ \ - FIELD(hal_bit_t,spindle_decrease) /* pin for making the spindle go slower */ \ -\ - FIELD(hal_bit_t,spindle_brake_on) /* pin for activating spindle-brake */ \ - FIELD(hal_bit_t,spindle_brake_off) /* pin for deactivating spindle/brake */ \ - FIELD(hal_bit_t,spindle_brake_is_on) /* status pin that tells us if brake is on */ \ -\ - ARRAY(hal_bit_t,joint_home,EMCMOT_MAX_JOINTS+1) /* pin for homing one joint */ \ - ARRAY(hal_bit_t,joint_unhome,EMCMOT_MAX_JOINTS+1) /* pin for unhoming one joint */ \ - ARRAY(hal_bit_t,joint_is_homed,EMCMOT_MAX_JOINTS+1) /* status pin that the joint is homed */ \ - ARRAY(hal_bit_t,joint_on_soft_min_limit,EMCMOT_MAX_JOINTS+1) /* status pin that the joint is on the software min limit */ \ - ARRAY(hal_bit_t,joint_on_soft_max_limit,EMCMOT_MAX_JOINTS+1) /* status pin that the joint is on the software max limit */ \ - ARRAY(hal_bit_t,joint_on_hard_min_limit,EMCMOT_MAX_JOINTS+1) /* status pin that the joint is on the hardware min limit */ \ - ARRAY(hal_bit_t,joint_on_hard_max_limit,EMCMOT_MAX_JOINTS+1) /* status pin that the joint is on the hardware max limit */ \ - ARRAY(hal_bit_t,joint_has_fault,EMCMOT_MAX_JOINTS+1) /* status pin that the joint has a fault */ \ - FIELD(hal_u32_t,joint_selected) /* status pin for the joint selected */ \ - ARRAY(hal_bit_t,joint_nr_select,EMCMOT_MAX_JOINTS) /* nr. of pins to select a joint */ \ - ARRAY(hal_bit_t,joint_is_selected,EMCMOT_MAX_JOINTS) /* nr. of status pins for joint selected */ \ -\ - ARRAY(hal_float_t,axis_pos_commanded,EMCMOT_MAX_AXIS+1) /* status pin for commanded cartesian position */ \ - ARRAY(hal_float_t,axis_pos_feedback,EMCMOT_MAX_AXIS+1) /* status pin for actual cartesian position */ \ - ARRAY(hal_float_t,axis_pos_relative,EMCMOT_MAX_AXIS+1) /* status pin for relative cartesian position */ \ -\ - FIELD(hal_float_t,jog_speed) /* pin for setting the jog speed (halui internal) */ \ - ARRAY(hal_bit_t,jog_minus,EMCMOT_MAX_JOINTS+1) /* pin to jog in positive direction */ \ - ARRAY(hal_bit_t,jog_plus,EMCMOT_MAX_JOINTS+1) /* pin to jog in negative direction */ \ - ARRAY(hal_float_t,jog_analog,EMCMOT_MAX_JOINTS+1) /* pin for analog jogging (-1..0..1) */ \ - ARRAY(hal_float_t,jog_increment,EMCMOT_MAX_JOINTS+1) /* Incremental jogging */ \ - ARRAY(hal_bit_t,jog_increment_plus,EMCMOT_MAX_JOINTS+1) /* Incremental jogging, positive direction */ \ - ARRAY(hal_bit_t,jog_increment_minus,EMCMOT_MAX_JOINTS+1) /* Incremental jogging, negative direction */ \ - FIELD(hal_float_t,jog_deadband) /* pin for setting the jog analog deadband (where not to move) */ \ -\ - FIELD(hal_s32_t,mv_counts) /* pin for the Max Velocity counting */ \ - FIELD(hal_bit_t,mv_count_enable) /* pin for the Max Velocity counting enable */ \ - FIELD(hal_bit_t,mv_direct_value) /* pin for enabling direct value option instead of counts */ \ - FIELD(hal_float_t,mv_scale) /* scale for the Max Velocity counting */ \ - FIELD(hal_float_t,mv_value) /* current Max Velocity value */ \ - FIELD(hal_bit_t,mv_increase) /* pin for increasing the MV (+=scale) */ \ - FIELD(hal_bit_t,mv_decrease) /* pin for decreasing the MV (-=scale) */ \ -\ - FIELD(hal_s32_t,ro_counts) /* pin for the Feed Override counting */ \ - FIELD(hal_bit_t,ro_count_enable) /* pin for the Feed Override counting enable */ \ - FIELD(hal_bit_t,ro_direct_value) /* pin for enabling direct value option instead of counts */ \ - FIELD(hal_float_t,ro_scale) /* scale for the Feed Override counting */ \ - FIELD(hal_float_t,ro_value) /* current Feed Override value */ \ - FIELD(hal_bit_t,ro_increase) /* pin ror increasing the FO (+=scale) */ \ - FIELD(hal_bit_t,ro_decrease) /* pin for decreasing the FO (-=scale) */ \ -\ - FIELD(hal_s32_t,fo_counts) /* pin for the Feed Override counting */ \ - FIELD(hal_bit_t,fo_count_enable) /* pin for the Feed Override counting enable */ \ - FIELD(hal_bit_t,fo_direct_value) /* pin for enabling direct value option instead of counts */ \ - FIELD(hal_float_t,fo_scale) /* scale for the Feed Override counting */ \ - FIELD(hal_float_t,fo_value) /* current Feed Override value */ \ - FIELD(hal_bit_t,fo_increase) /* pin for increasing the FO (+=scale) */ \ - FIELD(hal_bit_t,fo_decrease) /* pin for decreasing the FO (-=scale) */ \ -\ - FIELD(hal_s32_t,so_counts) /* pin for the Spindle Speed Override counting */ \ - FIELD(hal_bit_t,so_count_enable) /* pin for the Spindle Speed Override counting enable */ \ - FIELD(hal_bit_t,so_direct_value) /* pin for enabling direct value option instead of counts */ \ - FIELD(hal_float_t,so_scale) /* scale for the Spindle Speed Override counting */ \ - FIELD(hal_float_t,so_value) /* current Spindle speed Override value */ \ - FIELD(hal_bit_t,so_increase) /* pin for increasing the SO (+=scale) */ \ - FIELD(hal_bit_t,so_decrease) /* pin for decreasing the SO (-=scale) */ \ -\ - FIELD(hal_bit_t,home_all) /* pin for homing all joints in sequence */ \ - FIELD(hal_bit_t,abort) /* pin for aborting */ \ - ARRAY(hal_bit_t,mdi_commands,MDI_MAX) - -struct PTR { - template - struct field { typedef T *type; }; -}; - -template struct NATIVE {}; -template<> struct NATIVE { typedef bool type; }; -template<> struct NATIVE { typedef __s32 type; }; -template<> struct NATIVE { typedef __u32 type; }; -template<> struct NATIVE { typedef double type; }; -struct VALUE { - template struct field { typedef typename NATIVE::type type; }; -}; - -template -struct halui_str_base -{ -#define FIELD(t,f) typename T::template field::type f; -#define ARRAY(t,f,n) typename T::template field::type f[n]; -HAL_FIELDS -#undef FIELD -#undef ARRAY -}; - -typedef halui_str_base halui_str; -typedef halui_str_base local_halui_str; -#pragma GCC diagnostic pop - -static halui_str *halui_data; -static local_halui_str old_halui_data; - -static char *mdi_commands[MDI_MAX]; -static int num_mdi_commands=0; -static int have_home_all = 0; - -static int comp_id, done; /* component ID, main while loop */ - -static int num_axes = 3; //number of axes, taken from the ini [TRAJ] section - -static double maxFeedOverride=1; -static double maxMaxVelocity=1; -static double minSpindleOverride=0.0; -static double maxSpindleOverride=1.0; -static EMC_TASK_MODE_ENUM halui_old_mode = EMC_TASK_MODE_MANUAL; -static int halui_sent_mdi = 0; - -// the NML channels to the EMC task -static RCS_CMD_CHANNEL *emcCommandBuffer = 0; -static RCS_STAT_CHANNEL *emcStatusBuffer = 0; -EMC_STAT *emcStatus = 0; - -// the NML channel for errors -static NML *emcErrorBuffer = 0; - -// the serial number to use. By starting high we'll not clash with other guis so easily. -// XXX it would be nice to have a real fix here. XXX -static int emcCommandSerialNumber = 100000; - -// default value for timeout, 0 means wait forever -// use same timeout value as in tkemc & mini -static double receiveTimeout = 1.; -static double doneTimeout = 60.; - -static void quit(int sig) -{ - done = 1; -} - -static int emcTaskNmlGet() -{ - int retval = 0; - - // try to connect to EMC cmd - if (emcCommandBuffer == 0) { - emcCommandBuffer = - new RCS_CMD_CHANNEL(emcFormat, "emcCommand", "xemc", - emc_nmlfile); - if (!emcCommandBuffer->valid()) { - delete emcCommandBuffer; - emcCommandBuffer = 0; - retval = -1; - } - } - // try to connect to EMC status - if (emcStatusBuffer == 0) { - emcStatusBuffer = - new RCS_STAT_CHANNEL(emcFormat, "emcStatus", "xemc", - emc_nmlfile); - if (!emcStatusBuffer->valid()) { - delete emcStatusBuffer; - emcStatusBuffer = 0; - emcStatus = 0; - retval = -1; - } else { - emcStatus = (EMC_STAT *) emcStatusBuffer->get_address(); - } - } - - return retval; -} - -static int emcErrorNmlGet() -{ - int retval = 0; - - if (emcErrorBuffer == 0) { - emcErrorBuffer = - new NML(nmlErrorFormat, "emcError", "xemc", emc_nmlfile); - if (!emcErrorBuffer->valid()) { - delete emcErrorBuffer; - emcErrorBuffer = 0; - retval = -1; - } - } - - return retval; -} - -static int tryNml() -{ - double end; - int good; -#define RETRY_TIME 10.0 // seconds to wait for subsystems to come up -#define RETRY_INTERVAL 1.0 // seconds between wait tries for a subsystem - - if ((emc_debug & EMC_DEBUG_NML) == 0) { - set_rcs_print_destination(RCS_PRINT_TO_NULL); // inhibit diag - // messages - } - end = RETRY_TIME; - good = 0; - do { - if (0 == emcTaskNmlGet()) { - good = 1; - break; - } - esleep(RETRY_INTERVAL); - end -= RETRY_INTERVAL; - } while (end > 0.0); - if ((emc_debug & EMC_DEBUG_NML) == 0) { - set_rcs_print_destination(RCS_PRINT_TO_STDOUT); // inhibit diag - // messages - } - if (!good) { - return -1; - } - - if ((emc_debug & EMC_DEBUG_NML) == 0) { - set_rcs_print_destination(RCS_PRINT_TO_NULL); // inhibit diag - // messages - } - end = RETRY_TIME; - good = 0; - do { - if (0 == emcErrorNmlGet()) { - good = 1; - break; - } - esleep(RETRY_INTERVAL); - end -= RETRY_INTERVAL; - } while (end > 0.0); - if ((emc_debug & EMC_DEBUG_NML) == 0) { - set_rcs_print_destination(RCS_PRINT_TO_STDOUT); // inhibit diag - // messages - } - if (!good) { - return -1; - } - - return 0; - -#undef RETRY_TIME -#undef RETRY_INTERVAL -} - -static int updateStatus() -{ - NMLTYPE type; - - if (0 == emcStatus || 0 == emcStatusBuffer - || !emcStatusBuffer->valid()) { - return -1; - } - - switch (type = emcStatusBuffer->peek()) { - case -1: - // error on CMS channel - return -1; - break; - - case 0: // no new data - case EMC_STAT_TYPE: // new data - break; - - default: - return -1; - break; - } - - return 0; -} - - -#define EMC_COMMAND_DELAY 0.1 // how long to sleep between checks - -/* - emcCommandWaitReceived() waits until the EMC reports that it got - the command with the indicated serial_number. - emcCommandWaitDone() waits until the EMC reports that it got the - command with the indicated serial_number, and it's done, or error. -*/ - -static int emcCommandWaitReceived(int serial_number) -{ - double end = 0.0; - - while (end < receiveTimeout) { - updateStatus(); - - if (emcStatus->echo_serial_number == serial_number) { - return 0; - } - - esleep(EMC_COMMAND_DELAY); - end += EMC_COMMAND_DELAY; - } - - return -1; -} - -static int emcCommandWaitDone(int serial_number) -{ - double end = 0.0; - - // first get it there - if (0 != emcCommandWaitReceived(serial_number)) { - return -1; - } - // now wait until it, or subsequent command (e.g., abort) is done - while (end < doneTimeout) { - updateStatus(); - - if (emcStatus->status == RCS_DONE) { - return 0; - } - - if (emcStatus->status == RCS_ERROR) { - return -1; - } - - esleep(EMC_COMMAND_DELAY); - end += EMC_COMMAND_DELAY; - } - return -1; -} - -static void thisQuit() -{ - //don't forget the big HAL sin ;) - hal_exit(comp_id); - - if(emcCommandBuffer) { delete emcCommandBuffer; emcCommandBuffer = 0; } - if(emcStatusBuffer) { delete emcStatusBuffer; emcStatusBuffer = 0; } - if(emcErrorBuffer) { delete emcErrorBuffer; emcErrorBuffer = 0; } - exit(0); -} - -static enum { - LINEAR_UNITS_CUSTOM = 1, - LINEAR_UNITS_AUTO, - LINEAR_UNITS_MM, - LINEAR_UNITS_INCH, - LINEAR_UNITS_CM -} linearUnitConversion = LINEAR_UNITS_AUTO; - -static enum { - ANGULAR_UNITS_CUSTOM = 1, - ANGULAR_UNITS_AUTO, - ANGULAR_UNITS_DEG, - ANGULAR_UNITS_RAD, - ANGULAR_UNITS_GRAD -} angularUnitConversion = ANGULAR_UNITS_AUTO; - -#define CLOSE(a,b,eps) ((a)-(b) < +(eps) && (a)-(b) > -(eps)) -#define LINEAR_CLOSENESS 0.0001 -#define ANGULAR_CLOSENESS 0.0001 -#define INCH_PER_MM (1.0/25.4) -#define CM_PER_MM 0.1 -#define GRAD_PER_DEG (100.0/90.0) -#define RAD_PER_DEG TO_RAD // from posemath.h - -int halui_export_pin_IN_bit(hal_bit_t **pin, const char *name) -{ - int retval; - retval = hal_pin_bit_new(name, HAL_IN, pin, comp_id); - if (retval < 0) { - rtapi_print_msg(RTAPI_MSG_ERR,"HALUI: ERROR: halui pin %s export failed with err=%i\n", name, retval); - hal_exit(comp_id); - return -1; - } - return 0; -} - -int halui_export_pin_IN_s32(hal_s32_t **pin, const char *name) -{ - int retval; - retval = hal_pin_s32_new(name, HAL_IN, pin, comp_id); - if (retval < 0) { - rtapi_print_msg(RTAPI_MSG_ERR,"HALUI: ERROR: halui pin %s export failed with err=%i\n", name, retval); - hal_exit(comp_id); - return -1; - } - return 0; -} - -int halui_export_pin_IN_float(hal_float_t **pin, const char *name) -{ - int retval; - retval = hal_pin_float_new(name, HAL_IN, pin, comp_id); - if (retval < 0) { - rtapi_print_msg(RTAPI_MSG_ERR,"HALUI: ERROR: halui pin %s export failed with err=%i\n", name, retval); - hal_exit(comp_id); - return -1; - } - return 0; -} - - -int halui_export_pin_OUT_bit(hal_bit_t **pin, const char *name) -{ - int retval; - retval = hal_pin_bit_new(name, HAL_OUT, pin, comp_id); - if (retval < 0) { - rtapi_print_msg(RTAPI_MSG_ERR,"HALUI: ERROR: halui pin %s export failed with err=%i\n", name, retval); - hal_exit(comp_id); - return -1; - } - return 0; -} - - -/******************************************************************** -* -* Description: halui_hal_init(void) -* -* Side Effects: Exports HAL pins. -* -* Called By: main -********************************************************************/ -int halui_hal_init(void) -{ - int retval; - int joint; - int axis; - - /* STEP 1: initialise the hal component */ - comp_id = hal_init("halui"); - if (comp_id < 0) { - rtapi_print_msg(RTAPI_MSG_ERR, - "HALUI: ERROR: hal_init() failed\n"); - return -1; - } - - /* STEP 2: allocate shared memory for halui data */ - halui_data = (halui_str *) hal_malloc(sizeof(halui_str)); - if (halui_data == 0) { - rtapi_print_msg(RTAPI_MSG_ERR, - "HALUI: ERROR: hal_malloc() failed\n"); - hal_exit(comp_id); - return -1; - } - - /* STEP 3a: export the out-pin(s) */ - - retval = halui_export_pin_OUT_bit(&(halui_data->machine_is_on), "halui.machine.is-on"); - if (retval < 0) return retval; - retval = halui_export_pin_OUT_bit(&(halui_data->estop_is_activated), "halui.estop.is-activated"); - if (retval < 0) return retval; - retval = halui_export_pin_OUT_bit(&(halui_data->mode_is_manual), "halui.mode.is-manual"); - if (retval < 0) return retval; - retval = halui_export_pin_OUT_bit(&(halui_data->mode_is_auto), "halui.mode.is-auto"); - if (retval < 0) return retval; - retval = halui_export_pin_OUT_bit(&(halui_data->mode_is_mdi), "halui.mode.is-mdi"); - if (retval < 0) return retval; - retval = halui_export_pin_OUT_bit(&(halui_data->mode_is_teleop), "halui.mode.is-teleop"); - if (retval < 0) return retval; - retval = halui_export_pin_OUT_bit(&(halui_data->mode_is_joint), "halui.mode.is-joint"); - if (retval < 0) return retval; - retval = halui_export_pin_OUT_bit(&(halui_data->mist_is_on), "halui.mist.is-on"); - if (retval < 0) return retval; - retval = halui_export_pin_OUT_bit(&(halui_data->flood_is_on), "halui.flood.is-on"); - if (retval < 0) return retval; - retval = halui_export_pin_OUT_bit(&(halui_data->lube_is_on), "halui.lube.is-on"); - if (retval < 0) return retval; - retval = halui_export_pin_OUT_bit(&(halui_data->program_is_idle), "halui.program.is-idle"); - if (retval < 0) return retval; - retval = halui_export_pin_OUT_bit(&(halui_data->program_is_running), "halui.program.is-running"); - if (retval < 0) return retval; - retval = halui_export_pin_OUT_bit(&(halui_data->program_is_paused), "halui.program.is-paused"); - if (retval < 0) return retval; - retval = halui_export_pin_OUT_bit(&(halui_data->program_os_is_on), "halui.program.optional-stop.is-on"); - if (retval < 0) return retval; - retval = halui_export_pin_OUT_bit(&(halui_data->program_bd_is_on), "halui.program.block-delete.is-on"); - if (retval < 0) return retval; - retval = halui_export_pin_OUT_bit(&(halui_data->spindle_is_on), "halui.spindle.is-on"); - if (retval < 0) return retval; - retval = halui_export_pin_OUT_bit(&(halui_data->spindle_runs_forward), "halui.spindle.runs-forward"); - if (retval < 0) return retval; - retval = halui_export_pin_OUT_bit(&(halui_data->spindle_runs_backward), "halui.spindle.runs-backward"); - if (retval < 0) return retval; - retval = halui_export_pin_OUT_bit(&(halui_data->spindle_brake_is_on), "halui.spindle.brake-is-on"); - if (retval < 0) return retval; - - for (joint=0; joint < num_axes ; joint++) { - retval = hal_pin_bit_newf(HAL_OUT, &(halui_data->joint_is_homed[joint]), comp_id, "halui.joint.%d.is-homed", joint); - if (retval < 0) return retval; - retval = hal_pin_bit_newf(HAL_OUT, &(halui_data->joint_is_selected[joint]), comp_id, "halui.joint.%d.is-selected", joint); - if (retval < 0) return retval; - retval = hal_pin_bit_newf(HAL_OUT, &(halui_data->joint_on_soft_min_limit[joint]), comp_id, "halui.joint.%d.on-soft-min-limit", joint); - if (retval < 0) return retval; - retval = hal_pin_bit_newf(HAL_OUT, &(halui_data->joint_on_soft_max_limit[joint]), comp_id, "halui.joint.%d.on-soft-max-limit", joint); - if (retval < 0) return retval; - retval = hal_pin_bit_newf(HAL_OUT, &(halui_data->joint_on_hard_min_limit[joint]), comp_id, "halui.joint.%d.on-hard-min-limit", joint); - if (retval < 0) return retval; - retval = hal_pin_bit_newf(HAL_OUT, &(halui_data->joint_on_hard_max_limit[joint]), comp_id, "halui.joint.%d.on-hard-max-limit", joint); - if (retval < 0) return retval; - retval = hal_pin_bit_newf(HAL_OUT, &(halui_data->joint_has_fault[joint]), comp_id, "halui.joint.%d.has-fault", joint); - if (retval < 0) return retval; - } - - retval = hal_pin_bit_newf(HAL_OUT, &(halui_data->joint_on_soft_min_limit[num_axes]), comp_id, "halui.joint.selected.on-soft-min-limit"); - if (retval < 0) return retval; - retval = hal_pin_bit_newf(HAL_OUT, &(halui_data->joint_on_soft_max_limit[num_axes]), comp_id, "halui.joint.selected.on-soft-limit"); - if (retval < 0) return retval; - retval = hal_pin_bit_newf(HAL_OUT, &(halui_data->joint_on_hard_min_limit[num_axes]), comp_id, "halui.joint.selected.on-hard-min-limit"); - if (retval < 0) return retval; - retval = hal_pin_bit_newf(HAL_OUT, &(halui_data->joint_on_hard_max_limit[num_axes]), comp_id, "halui.joint.selected.on-hard-max-limit"); - if (retval < 0) return retval; - retval = hal_pin_bit_newf(HAL_OUT, &(halui_data->joint_has_fault[num_axes]), comp_id, "halui.joint.selected.has-fault"); - if (retval < 0) return retval; - retval = hal_pin_bit_newf(HAL_OUT, &(halui_data->joint_is_homed[num_axes]), comp_id, "halui.joint.selected.is_homed"); - if (retval < 0) return retval; - - for (axis=0; axis < EMCMOT_MAX_AXIS ; axis++) { - retval = hal_pin_float_newf(HAL_OUT, &(halui_data->axis_pos_commanded[axis]), comp_id, "halui.axis.%d.pos-commanded", axis); - if (retval < 0) return retval; - retval = hal_pin_float_newf(HAL_OUT, &(halui_data->axis_pos_feedback[axis]), comp_id, "halui.axis.%d.pos-feedback", axis); - if (retval < 0) return retval; - retval = hal_pin_float_newf(HAL_OUT, &(halui_data->axis_pos_relative[axis]), comp_id, "halui.axis.%d.pos-relative", axis); - if (retval < 0) return retval; - } - - retval = hal_pin_float_newf(HAL_OUT, &(halui_data->mv_value), comp_id, "halui.max-velocity.value"); - if (retval < 0) return retval; - retval = hal_pin_float_newf(HAL_OUT, &(halui_data->fo_value), comp_id, "halui.feed-override.value"); - if (retval < 0) return retval; - retval = hal_pin_float_newf(HAL_OUT, &(halui_data->ro_value), comp_id, "halui.rapid-override.value"); - if (retval < 0) return retval; - retval = hal_pin_u32_newf(HAL_OUT, &(halui_data->joint_selected), comp_id, "halui.joint.selected"); - if (retval < 0) return retval; - retval = hal_pin_u32_newf(HAL_OUT, &(halui_data->tool_number), comp_id, "halui.tool.number"); - if (retval < 0) return retval; - retval = hal_pin_float_newf(HAL_OUT, &(halui_data->tool_length_offset_x), comp_id, "halui.tool.length_offset.x"); - if (retval < 0) return retval; - retval = hal_pin_float_newf(HAL_OUT, &(halui_data->tool_length_offset_y), comp_id, "halui.tool.length_offset.y"); - if (retval < 0) return retval; - retval = hal_pin_float_newf(HAL_OUT, &(halui_data->tool_length_offset_z), comp_id, "halui.tool.length_offset.z"); - if (retval < 0) return retval; - retval = hal_pin_float_newf(HAL_OUT, &(halui_data->tool_length_offset_a), comp_id, "halui.tool.length_offset.a"); - if (retval < 0) return retval; - retval = hal_pin_float_newf(HAL_OUT, &(halui_data->tool_length_offset_b), comp_id, "halui.tool.length_offset.b"); - if (retval < 0) return retval; - retval = hal_pin_float_newf(HAL_OUT, &(halui_data->tool_length_offset_c), comp_id, "halui.tool.length_offset.c"); - if (retval < 0) return retval; - retval = hal_pin_float_newf(HAL_OUT, &(halui_data->tool_length_offset_u), comp_id, "halui.tool.length_offset.u"); - if (retval < 0) return retval; - retval = hal_pin_float_newf(HAL_OUT, &(halui_data->tool_length_offset_v), comp_id, "halui.tool.length_offset.v"); - if (retval < 0) return retval; - retval = hal_pin_float_newf(HAL_OUT, &(halui_data->tool_length_offset_w), comp_id, "halui.tool.length_offset.w"); - if (retval < 0) return retval; - retval = hal_pin_float_newf(HAL_OUT, &(halui_data->so_value), comp_id, "halui.spindle-override.value"); - if (retval < 0) return retval; - - /* STEP 3b: export the in-pin(s) */ - - retval = halui_export_pin_IN_bit(&(halui_data->machine_on), "halui.machine.on"); - if (retval < 0) return retval; - retval = halui_export_pin_IN_bit(&(halui_data->machine_off), "halui.machine.off"); - if (retval < 0) return retval; - retval = halui_export_pin_IN_bit(&(halui_data->estop_activate), "halui.estop.activate"); - if (retval < 0) return retval; - retval = halui_export_pin_IN_bit(&(halui_data->estop_reset), "halui.estop.reset"); - if (retval < 0) return retval; - retval = halui_export_pin_IN_bit(&(halui_data->mode_manual), "halui.mode.manual"); - if (retval < 0) return retval; - retval = halui_export_pin_IN_bit(&(halui_data->mode_auto), "halui.mode.auto"); - if (retval < 0) return retval; - retval = halui_export_pin_IN_bit(&(halui_data->mode_mdi), "halui.mode.mdi"); - if (retval < 0) return retval; - retval = halui_export_pin_IN_bit(&(halui_data->mode_teleop), "halui.mode.teleop"); - if (retval < 0) return retval; - retval = halui_export_pin_IN_bit(&(halui_data->mode_joint), "halui.mode.joint"); - if (retval < 0) return retval; - retval = halui_export_pin_IN_bit(&(halui_data->mist_on), "halui.mist.on"); - if (retval < 0) return retval; - retval = halui_export_pin_IN_bit(&(halui_data->mist_off), "halui.mist.off"); - if (retval < 0) return retval; - retval = halui_export_pin_IN_bit(&(halui_data->flood_on), "halui.flood.on"); - if (retval < 0) return retval; - retval = halui_export_pin_IN_bit(&(halui_data->flood_off), "halui.flood.off"); - if (retval < 0) return retval; - retval = halui_export_pin_IN_bit(&(halui_data->lube_on), "halui.lube.on"); - if (retval < 0) return retval; - retval = halui_export_pin_IN_bit(&(halui_data->lube_off), "halui.lube.off"); - if (retval < 0) return retval; - retval = halui_export_pin_IN_bit(&(halui_data->program_run), "halui.program.run"); - if (retval < 0) return retval; - retval = halui_export_pin_IN_bit(&(halui_data->program_pause), "halui.program.pause"); - if (retval < 0) return retval; - retval = halui_export_pin_IN_bit(&(halui_data->program_resume), "halui.program.resume"); - if (retval < 0) return retval; - retval = halui_export_pin_IN_bit(&(halui_data->program_step), "halui.program.step"); - if (retval < 0) return retval; - retval = halui_export_pin_IN_bit(&(halui_data->program_stop), "halui.program.stop"); - if (retval < 0) return retval; - retval = halui_export_pin_IN_bit(&(halui_data->program_os_on), "halui.program.optional-stop.on"); - if (retval < 0) return retval; - retval = halui_export_pin_IN_bit(&(halui_data->program_os_off), "halui.program.optional-stop.off"); - if (retval < 0) return retval; - retval = halui_export_pin_IN_bit(&(halui_data->program_bd_on), "halui.program.block-delete.on"); - if (retval < 0) return retval; - retval = halui_export_pin_IN_bit(&(halui_data->program_bd_off), "halui.program.block-delete.off"); - if (retval < 0) return retval; - - retval = halui_export_pin_IN_bit(&(halui_data->spindle_start), "halui.spindle.start"); - if (retval < 0) return retval; - retval = halui_export_pin_IN_bit(&(halui_data->spindle_stop), "halui.spindle.stop"); - if (retval < 0) return retval; - retval = halui_export_pin_IN_bit(&(halui_data->spindle_forward), "halui.spindle.forward"); - if (retval < 0) return retval; - retval = halui_export_pin_IN_bit(&(halui_data->spindle_reverse), "halui.spindle.reverse"); - if (retval < 0) return retval; - retval = halui_export_pin_IN_bit(&(halui_data->spindle_increase), "halui.spindle.increase"); - if (retval < 0) return retval; - retval = halui_export_pin_IN_bit(&(halui_data->spindle_decrease), "halui.spindle.decrease"); - if (retval < 0) return retval; - retval = halui_export_pin_IN_bit(&(halui_data->spindle_brake_on), "halui.spindle.brake-on"); - if (retval < 0) return retval; - retval = halui_export_pin_IN_bit(&(halui_data->spindle_brake_off), "halui.spindle.brake-off"); - if (retval < 0) return retval; - - retval = halui_export_pin_IN_s32(&(halui_data->mv_counts), "halui.max-velocity.counts"); - if (retval < 0) return retval; - *halui_data->mv_counts = 0; - retval = halui_export_pin_IN_bit(&(halui_data->mv_count_enable), "halui.max-velocity.count-enable"); - if (retval < 0) return retval; - *halui_data->mv_count_enable = 1; - retval = halui_export_pin_IN_bit(&(halui_data->mv_direct_value), "halui.max-velocity.direct-value"); - if (retval < 0) return retval; - *halui_data->mv_direct_value = 0; - retval = halui_export_pin_IN_float(&(halui_data->mv_scale), "halui.max-velocity.scale"); - if (retval < 0) return retval; - retval = halui_export_pin_IN_bit(&(halui_data->mv_increase), "halui.max-velocity.increase"); - if (retval < 0) return retval; - retval = halui_export_pin_IN_bit(&(halui_data->mv_decrease), "halui.max-velocity.decrease"); - if (retval < 0) return retval; - - retval = halui_export_pin_IN_s32(&(halui_data->fo_counts), "halui.feed-override.counts"); - if (retval < 0) return retval; - *halui_data->fo_counts = 0; - retval = halui_export_pin_IN_bit(&(halui_data->fo_count_enable), "halui.feed-override.count-enable"); - if (retval < 0) return retval; - *halui_data->fo_count_enable = 1; - retval = halui_export_pin_IN_bit(&(halui_data->fo_direct_value), "halui.feed-override.direct-value"); - if (retval < 0) return retval; - *halui_data->fo_direct_value = 0; - retval = halui_export_pin_IN_float(&(halui_data->fo_scale), "halui.feed-override.scale"); - if (retval < 0) return retval; - retval = halui_export_pin_IN_bit(&(halui_data->fo_increase), "halui.feed-override.increase"); - if (retval < 0) return retval; - retval = halui_export_pin_IN_bit(&(halui_data->fo_decrease), "halui.feed-override.decrease"); - if (retval < 0) return retval; - - retval = halui_export_pin_IN_s32(&(halui_data->ro_counts), "halui.rapid-override.counts"); - if (retval < 0) return retval; - *halui_data->ro_counts = 0; - retval = halui_export_pin_IN_bit(&(halui_data->ro_count_enable), "halui.rapid-override.count-enable"); - if (retval < 0) return retval; - *halui_data->ro_count_enable = 1; - retval = halui_export_pin_IN_bit(&(halui_data->ro_direct_value), "halui.rapid-override.direct-value"); - if (retval < 0) return retval; - *halui_data->ro_direct_value = 0; - retval = halui_export_pin_IN_float(&(halui_data->ro_scale), "halui.rapid-override.scale"); - if (retval < 0) return retval; - retval = halui_export_pin_IN_bit(&(halui_data->ro_increase), "halui.rapid-override.increase"); - if (retval < 0) return retval; - retval = halui_export_pin_IN_bit(&(halui_data->ro_decrease), "halui.rapid-override.decrease"); - if (retval < 0) return retval; - - retval = halui_export_pin_IN_s32(&(halui_data->so_counts), "halui.spindle-override.counts"); - if (retval < 0) return retval; - *halui_data->so_counts = 0; - retval = halui_export_pin_IN_bit(&(halui_data->so_count_enable), "halui.spindle-override.count-enable"); - if (retval < 0) return retval; - *halui_data->so_count_enable = 1; - retval = halui_export_pin_IN_bit(&(halui_data->so_direct_value), "halui.spindle-override.direct-value"); - if (retval < 0) return retval; - *halui_data->so_direct_value = 0; - retval = halui_export_pin_IN_float(&(halui_data->so_scale), "halui.spindle-override.scale"); - if (retval < 0) return retval; - retval = halui_export_pin_IN_bit(&(halui_data->so_increase), "halui.spindle-override.increase"); - if (retval < 0) return retval; - retval = halui_export_pin_IN_bit(&(halui_data->so_decrease), "halui.spindle-override.decrease"); - if (retval < 0) return retval; - - if (have_home_all) { - retval = halui_export_pin_IN_bit(&(halui_data->home_all), "halui.home-all"); - if (retval < 0) return retval; - } - - retval = halui_export_pin_IN_bit(&(halui_data->abort), "halui.abort"); - if (retval < 0) return retval; - - for (joint=0; joint < num_axes ; joint++) { - retval = hal_pin_bit_newf(HAL_IN, &(halui_data->joint_home[joint]), comp_id, "halui.joint.%d.home", joint); - if (retval < 0) return retval; - retval = hal_pin_bit_newf(HAL_IN, &(halui_data->joint_unhome[joint]), comp_id, "halui.joint.%d.unhome", joint); - if (retval < 0) return retval; - retval = hal_pin_bit_newf(HAL_IN, &(halui_data->joint_nr_select[joint]), comp_id, "halui.joint.%d.select", joint); - if (retval < 0) return retval; - retval = hal_pin_bit_newf(HAL_IN, &(halui_data->jog_plus[joint]), comp_id, "halui.jog.%d.plus", joint); - if (retval < 0) return retval; - retval = hal_pin_bit_newf(HAL_IN, &(halui_data->jog_minus[joint]), comp_id, "halui.jog.%d.minus", joint); - if (retval < 0) return retval; - retval = hal_pin_float_newf(HAL_IN, &(halui_data->jog_analog[joint]), comp_id, "halui.jog.%d.analog", joint); - if (retval < 0) return retval; - retval = hal_pin_float_newf(HAL_IN, &(halui_data->jog_increment[joint]), comp_id, "halui.jog.%d.increment", joint); - if (retval < 0) return retval; - retval = hal_pin_bit_newf(HAL_IN, &(halui_data->jog_increment_plus[joint]), comp_id, "halui.jog.%d.increment-plus", joint); - if (retval < 0) return retval; - retval = hal_pin_bit_newf(HAL_IN, &(halui_data->jog_increment_minus[joint]), comp_id, "halui.jog.%d.increment-minus", joint); - if (retval < 0) return retval; - } - - retval = hal_pin_bit_newf(HAL_IN, &(halui_data->joint_home[num_axes]), comp_id, "halui.joint.selected.home"); - if (retval < 0) return retval; - retval = hal_pin_bit_newf(HAL_IN, &(halui_data->joint_unhome[num_axes]), comp_id, "halui.joint.selected.unhome"); - if (retval < 0) return retval; - retval = hal_pin_bit_newf(HAL_IN, &(halui_data->jog_plus[num_axes]), comp_id, "halui.jog.selected.plus"); - if (retval < 0) return retval; - retval = hal_pin_bit_newf(HAL_IN, &(halui_data->jog_minus[num_axes]), comp_id, "halui.jog.selected.minus"); - if (retval < 0) return retval; - retval = hal_pin_float_newf(HAL_IN, &(halui_data->jog_increment[num_axes]), comp_id, "halui.jog.selected.increment"); - if (retval < 0) return retval; - retval = hal_pin_bit_newf(HAL_IN, &(halui_data->jog_increment_plus[num_axes]), comp_id, "halui.jog.selected.increment-plus"); - if (retval < 0) return retval; - retval = hal_pin_bit_newf(HAL_IN, &(halui_data->jog_increment_minus[num_axes]), comp_id, "halui.jog.selected.increment-minus"); - if (retval < 0) return retval; - retval = halui_export_pin_IN_float(&(halui_data->jog_speed), "halui.jog-speed"); - if (retval < 0) return retval; - retval = halui_export_pin_IN_float(&(halui_data->jog_deadband), "halui.jog-deadband"); - if (retval < 0) return retval; - - - for (int n=0; nmdi_commands[n]), comp_id, "halui.mdi-command-%02d", n); - if (retval < 0) return retval; - } - - hal_ready(comp_id); - return 0; -} - -static int sendMachineOn() -{ - EMC_TASK_SET_STATE state_msg; - - state_msg.state = EMC_TASK_STATE_ON; - state_msg.serial_number = ++emcCommandSerialNumber; - emcCommandBuffer->write(state_msg); - return emcCommandWaitReceived(emcCommandSerialNumber); -} - -static int sendMachineOff() -{ - EMC_TASK_SET_STATE state_msg; - - state_msg.state = EMC_TASK_STATE_OFF; - state_msg.serial_number = ++emcCommandSerialNumber; - emcCommandBuffer->write(state_msg); - return emcCommandWaitReceived(emcCommandSerialNumber); -} - -static int sendEstop() -{ - EMC_TASK_SET_STATE state_msg; - - state_msg.state = EMC_TASK_STATE_ESTOP; - state_msg.serial_number = ++emcCommandSerialNumber; - emcCommandBuffer->write(state_msg); - return emcCommandWaitReceived(emcCommandSerialNumber); -} - -static int sendEstopReset() -{ - EMC_TASK_SET_STATE state_msg; - - state_msg.state = EMC_TASK_STATE_ESTOP_RESET; - state_msg.serial_number = ++emcCommandSerialNumber; - emcCommandBuffer->write(state_msg); - return emcCommandWaitReceived(emcCommandSerialNumber); -} - -static int sendManual() -{ - EMC_TASK_SET_MODE mode_msg; - - if (emcStatus->task.mode == EMC_TASK_MODE_MANUAL) { - return 0; - } - - mode_msg.mode = EMC_TASK_MODE_MANUAL; - mode_msg.serial_number = ++emcCommandSerialNumber; - emcCommandBuffer->write(mode_msg); - return emcCommandWaitReceived(emcCommandSerialNumber); -} - -static int sendAuto() -{ - EMC_TASK_SET_MODE mode_msg; - - if (emcStatus->task.mode == EMC_TASK_MODE_AUTO) { - return 0; - } - - mode_msg.mode = EMC_TASK_MODE_AUTO; - mode_msg.serial_number = ++emcCommandSerialNumber; - emcCommandBuffer->write(mode_msg); - return emcCommandWaitReceived(emcCommandSerialNumber); -} - -static int sendMdi() -{ - EMC_TASK_SET_MODE mode_msg; - - if (emcStatus->task.mode == EMC_TASK_MODE_MDI) { - return 0; - } - - mode_msg.mode = EMC_TASK_MODE_MDI; - mode_msg.serial_number = ++emcCommandSerialNumber; - emcCommandBuffer->write(mode_msg); - return emcCommandWaitReceived(emcCommandSerialNumber); -} - -int sendMdiCmd(char *mdi) -{ - EMC_TASK_PLAN_EXECUTE emc_task_plan_execute_msg; - - if (emcStatus->task.mode != EMC_TASK_MODE_MDI) { - halui_old_mode = emcStatus->task.mode; - sendMdi(); - } - strcpy(emc_task_plan_execute_msg.command, mdi); - emc_task_plan_execute_msg.serial_number = ++emcCommandSerialNumber; - emcCommandBuffer->write(emc_task_plan_execute_msg); - halui_sent_mdi = 1; - return emcCommandWaitReceived(emcCommandSerialNumber); -} - -static int sendMdiCommand(int n) -{ - int r1,r2; - halui_old_mode = emcStatus->task.mode; - r1 = sendMdi(); - r2 = sendMdiCmd(mdi_commands[n]); - return r1 || r2; -} - - -static int sendTeleop() -{ - EMC_TRAJ_SET_TELEOP_ENABLE emc_set_teleop_enable_msg; - - emc_set_teleop_enable_msg.enable = 1; - emc_set_teleop_enable_msg.serial_number = ++emcCommandSerialNumber; - emcCommandBuffer->write(emc_set_teleop_enable_msg); - return emcCommandWaitDone(emcCommandSerialNumber); -} - -static int sendJoint() -{ - EMC_TRAJ_SET_TELEOP_ENABLE emc_set_teleop_enable_msg; - - emc_set_teleop_enable_msg.enable = 0; - emc_set_teleop_enable_msg.serial_number = ++emcCommandSerialNumber; - emcCommandBuffer->write(emc_set_teleop_enable_msg); - return emcCommandWaitDone(emcCommandSerialNumber); -} - -static int sendMistOn() -{ - EMC_COOLANT_MIST_ON emc_coolant_mist_on_msg; - - emc_coolant_mist_on_msg.serial_number = ++emcCommandSerialNumber; - emcCommandBuffer->write(emc_coolant_mist_on_msg); - return emcCommandWaitReceived(emcCommandSerialNumber); -} - -static int sendMistOff() -{ - EMC_COOLANT_MIST_OFF emc_coolant_mist_off_msg; - - emc_coolant_mist_off_msg.serial_number = ++emcCommandSerialNumber; - emcCommandBuffer->write(emc_coolant_mist_off_msg); - return emcCommandWaitReceived(emcCommandSerialNumber); -} - -static int sendFloodOn() -{ - EMC_COOLANT_FLOOD_ON emc_coolant_flood_on_msg; - - emc_coolant_flood_on_msg.serial_number = ++emcCommandSerialNumber; - emcCommandBuffer->write(emc_coolant_flood_on_msg); - return emcCommandWaitReceived(emcCommandSerialNumber); -} - -static int sendFloodOff() -{ - EMC_COOLANT_FLOOD_OFF emc_coolant_flood_off_msg; - - emc_coolant_flood_off_msg.serial_number = ++emcCommandSerialNumber; - emcCommandBuffer->write(emc_coolant_flood_off_msg); - return emcCommandWaitReceived(emcCommandSerialNumber); -} - -static int sendLubeOn() -{ - EMC_LUBE_ON emc_lube_on_msg; - - emc_lube_on_msg.serial_number = ++emcCommandSerialNumber; - emcCommandBuffer->write(emc_lube_on_msg); - return emcCommandWaitReceived(emcCommandSerialNumber); -} - -static int sendLubeOff() -{ - EMC_LUBE_OFF emc_lube_off_msg; - - emc_lube_off_msg.serial_number = ++emcCommandSerialNumber; - emcCommandBuffer->write(emc_lube_off_msg); - return emcCommandWaitReceived(emcCommandSerialNumber); -} - -// programStartLine is the saved valued of the line that -// sendProgramRun(int line) sent -static int programStartLine = 0; - -static int sendProgramRun(int line) -{ - EMC_TASK_PLAN_RUN emc_task_plan_run_msg; - - updateStatus(); - - if (0 == emcStatus->task.file[0]) { - return -1; // no program open - } - // save the start line, to compare against active line later - programStartLine = line; - - emc_task_plan_run_msg.serial_number = ++emcCommandSerialNumber; - emc_task_plan_run_msg.line = line; - emcCommandBuffer->write(emc_task_plan_run_msg); - return emcCommandWaitReceived(emcCommandSerialNumber); -} - -static int sendProgramPause() -{ - EMC_TASK_PLAN_PAUSE emc_task_plan_pause_msg; - - emc_task_plan_pause_msg.serial_number = ++emcCommandSerialNumber; - emcCommandBuffer->write(emc_task_plan_pause_msg); - return emcCommandWaitReceived(emcCommandSerialNumber); -} - -static int sendSetOptionalStop(bool state) -{ - EMC_TASK_PLAN_SET_OPTIONAL_STOP emc_task_plan_set_optional_stop_msg; - - emc_task_plan_set_optional_stop_msg.state = state; - emc_task_plan_set_optional_stop_msg.serial_number = ++emcCommandSerialNumber; - emcCommandBuffer->write(emc_task_plan_set_optional_stop_msg); - return emcCommandWaitReceived(emcCommandSerialNumber); -} - -static int sendSetBlockDelete(bool state) -{ - EMC_TASK_PLAN_SET_BLOCK_DELETE emc_task_plan_set_block_delete_msg; - - emc_task_plan_set_block_delete_msg.state = state; - emc_task_plan_set_block_delete_msg.serial_number = ++emcCommandSerialNumber; - emcCommandBuffer->write(emc_task_plan_set_block_delete_msg); - return emcCommandWaitReceived(emcCommandSerialNumber); -} - - -static int sendProgramResume() -{ - EMC_TASK_PLAN_RESUME emc_task_plan_resume_msg; - - emc_task_plan_resume_msg.serial_number = ++emcCommandSerialNumber; - emcCommandBuffer->write(emc_task_plan_resume_msg); - return emcCommandWaitReceived(emcCommandSerialNumber); -} - -static int sendProgramStep() -{ - EMC_TASK_PLAN_STEP emc_task_plan_step_msg; - - emc_task_plan_step_msg.serial_number = ++emcCommandSerialNumber; - emcCommandBuffer->write(emc_task_plan_step_msg); - return emcCommandWaitReceived(emcCommandSerialNumber); -} - -static int sendSpindleForward() -{ - EMC_SPINDLE_ON emc_spindle_on_msg; - if (emcStatus->task.activeSettings[2] != 0) { - emc_spindle_on_msg.speed = rtapi_fabs(emcStatus->task.activeSettings[2]); - } else { - emc_spindle_on_msg.speed = +1; - } - emc_spindle_on_msg.serial_number = ++emcCommandSerialNumber; - emcCommandBuffer->write(emc_spindle_on_msg); - return emcCommandWaitReceived(emcCommandSerialNumber); -} - -static int sendSpindleReverse() -{ - EMC_SPINDLE_ON emc_spindle_on_msg; - if (emcStatus->task.activeSettings[2] != 0) { - emc_spindle_on_msg.speed = - -1 * rtapi_fabs(emcStatus->task.activeSettings[2]); - } else { - emc_spindle_on_msg.speed = -1; - } - emc_spindle_on_msg.serial_number = ++emcCommandSerialNumber; - emcCommandBuffer->write(emc_spindle_on_msg); - return emcCommandWaitReceived(emcCommandSerialNumber); -} - -static int sendSpindleOff() -{ - EMC_SPINDLE_OFF emc_spindle_off_msg; - - emc_spindle_off_msg.serial_number = ++emcCommandSerialNumber; - emcCommandBuffer->write(emc_spindle_off_msg); - return emcCommandWaitReceived(emcCommandSerialNumber); -} - -static int sendSpindleIncrease() -{ - EMC_SPINDLE_INCREASE emc_spindle_increase_msg; - - emc_spindle_increase_msg.serial_number = ++emcCommandSerialNumber; - emcCommandBuffer->write(emc_spindle_increase_msg); - return emcCommandWaitReceived(emcCommandSerialNumber); -} - -static int sendSpindleDecrease() -{ - EMC_SPINDLE_DECREASE emc_spindle_decrease_msg; - - emc_spindle_decrease_msg.serial_number = ++emcCommandSerialNumber; - emcCommandBuffer->write(emc_spindle_decrease_msg); - return emcCommandWaitReceived(emcCommandSerialNumber); -} - -static int sendSpindleConstant() -{ - EMC_SPINDLE_CONSTANT emc_spindle_constant_msg; - - emc_spindle_constant_msg.serial_number = ++emcCommandSerialNumber; - emcCommandBuffer->write(emc_spindle_constant_msg); - return emcCommandWaitReceived(emcCommandSerialNumber); -} - -static int sendBrakeEngage() -{ - EMC_SPINDLE_BRAKE_ENGAGE emc_spindle_brake_engage_msg; - - emc_spindle_brake_engage_msg.serial_number = ++emcCommandSerialNumber; - emcCommandBuffer->write(emc_spindle_brake_engage_msg); - return emcCommandWaitReceived(emcCommandSerialNumber); -} - -static int sendBrakeRelease() -{ - EMC_SPINDLE_BRAKE_RELEASE emc_spindle_brake_release_msg; - - emc_spindle_brake_release_msg.serial_number = ++emcCommandSerialNumber; - emcCommandBuffer->write(emc_spindle_brake_release_msg); - return emcCommandWaitReceived(emcCommandSerialNumber); -} - -static int sendHome(int axis) -{ - EMC_AXIS_HOME emc_axis_home_msg; - - emc_axis_home_msg.serial_number = ++emcCommandSerialNumber; - emc_axis_home_msg.axis = axis; - emcCommandBuffer->write(emc_axis_home_msg); - return emcCommandWaitReceived(emcCommandSerialNumber); -} - -static int sendUnhome(int axis) -{ - EMC_AXIS_UNHOME emc_axis_unhome_msg; - - emc_axis_unhome_msg.serial_number = ++emcCommandSerialNumber; - emc_axis_unhome_msg.axis = axis; - emcCommandBuffer->write(emc_axis_unhome_msg); - return emcCommandWaitReceived(emcCommandSerialNumber); -} - -static int sendAbort() -{ - EMC_TASK_ABORT task_abort_msg; - - task_abort_msg.serial_number = ++emcCommandSerialNumber; - emcCommandBuffer->write(task_abort_msg); - return emcCommandWaitReceived(emcCommandSerialNumber); -} - - -static int sendJogStop(int axis) -{ - EMC_AXIS_ABORT emc_axis_abort_msg; - - // in case of TELEOP mode we really need to send an TELEOP_VECTOR message - // not a simple AXIS_ABORT, as more than one axis would be moving - // (hint TELEOP mode is for nontrivial kinematics) - EMC_TRAJ_SET_TELEOP_VECTOR emc_set_teleop_vector; - - if ((emcStatus->task.state != EMC_TASK_STATE_ON) || (emcStatus->task.mode != EMC_TASK_MODE_MANUAL)) - return -1; - - if (axis < 0 || axis >= EMC_AXIS_MAX) { - return -1; - } - - if (emcStatus->motion.traj.mode != EMC_TRAJ_MODE_TELEOP) { - emc_axis_abort_msg.serial_number = ++emcCommandSerialNumber; - emc_axis_abort_msg.axis = axis; - emcCommandBuffer->write(emc_axis_abort_msg); - - return emcCommandWaitReceived(emcCommandSerialNumber); - } else { - emc_set_teleop_vector.serial_number = ++emcCommandSerialNumber; - ZERO_EMC_POSE(emc_set_teleop_vector.vector); - emcCommandBuffer->write(emc_set_teleop_vector); - - return emcCommandWaitReceived(emcCommandSerialNumber); - } -} - -static int sendJogCont(int axis, double speed) -{ - EMC_AXIS_JOG emc_axis_jog_msg; - EMC_TRAJ_SET_TELEOP_VECTOR emc_set_teleop_vector; - - if (emcStatus->task.state != EMC_TASK_STATE_ON) { - return -1; - } - - if (axis < 0 || axis >= EMC_AXIS_MAX) { - return -1; - } - - sendManual(); - - if (emcStatus->motion.traj.mode != EMC_TRAJ_MODE_TELEOP) { - emc_axis_jog_msg.serial_number = ++emcCommandSerialNumber; - emc_axis_jog_msg.axis = axis; - emc_axis_jog_msg.vel = speed / 60.0; - emcCommandBuffer->write(emc_axis_jog_msg); - } else { - emc_set_teleop_vector.serial_number = ++emcCommandSerialNumber; - ZERO_EMC_POSE(emc_set_teleop_vector.vector); - - switch (axis) { - case 0: - emc_set_teleop_vector.vector.tran.x = speed / 60.0; - break; - case 1: - emc_set_teleop_vector.vector.tran.y = speed / 60.0; - break; - case 2: - emc_set_teleop_vector.vector.tran.z = speed / 60.0; - break; - case 3: - emc_set_teleop_vector.vector.a = speed / 60.0; - break; - case 4: - emc_set_teleop_vector.vector.b = speed / 60.0; - break; - case 5: - emc_set_teleop_vector.vector.c = speed / 60.0; - break; - } - emcCommandBuffer->write(emc_set_teleop_vector); - } - - return emcCommandWaitReceived(emcCommandSerialNumber); -} - - -static int sendJogInc(int axis, double speed, double inc) -{ - EMC_AXIS_INCR_JOG emc_axis_jog_msg; - - if (emcStatus->task.state != EMC_TASK_STATE_ON) { - return -1; - } - - if (axis < 0 || axis >= EMC_AXIS_MAX) - return -1; - - sendManual(); - - if (emcStatus->motion.traj.mode == EMC_TRAJ_MODE_TELEOP) - return -1; - - emc_axis_jog_msg.serial_number = ++emcCommandSerialNumber; - emc_axis_jog_msg.axis = axis; - emc_axis_jog_msg.vel = speed / 60.0; - emc_axis_jog_msg.incr = inc; - emcCommandBuffer->write(emc_axis_jog_msg); - - return emcCommandWaitReceived(emcCommandSerialNumber); -} - - -static int sendFeedOverride(double override) -{ - EMC_TRAJ_SET_SCALE emc_traj_set_scale_msg; - - if (override < 0.0) { - override = 0.0; - } - - if (override > maxFeedOverride) { - override = maxFeedOverride; - } - - emc_traj_set_scale_msg.serial_number = ++emcCommandSerialNumber; - emc_traj_set_scale_msg.scale = override; - emcCommandBuffer->write(emc_traj_set_scale_msg); - return emcCommandWaitReceived(emcCommandSerialNumber); -} - -static int sendRapidOverride(double override) -{ - EMC_TRAJ_SET_RAPID_SCALE emc_traj_set_scale_msg; - - if (override < 0.0) { - override = 0.0; - } - - if (override > 1.0) { - override = 1.0; - } - - emc_traj_set_scale_msg.serial_number = ++emcCommandSerialNumber; - emc_traj_set_scale_msg.scale = override; - emcCommandBuffer->write(emc_traj_set_scale_msg); - return emcCommandWaitReceived(emcCommandSerialNumber); -} - -static int sendMaxVelocity(double velocity) -{ - EMC_TRAJ_SET_MAX_VELOCITY mv; - - if (velocity < 0.0) { - velocity = 0.0; - } - - if (velocity > maxMaxVelocity) { - velocity = maxMaxVelocity; - } - - mv.serial_number = ++emcCommandSerialNumber; - mv.velocity = velocity; - emcCommandBuffer->write(mv); - return emcCommandWaitReceived(emcCommandSerialNumber); -} - -static int sendSpindleOverride(double override) -{ - EMC_TRAJ_SET_SPINDLE_SCALE emc_traj_set_spindle_scale_msg; - - if (override < minSpindleOverride) { - override = minSpindleOverride; - } - - if (override > maxSpindleOverride) { - override = maxSpindleOverride; - } - - emc_traj_set_spindle_scale_msg.serial_number = ++emcCommandSerialNumber; - emc_traj_set_spindle_scale_msg.scale = override; - emcCommandBuffer->write(emc_traj_set_spindle_scale_msg); - return emcCommandWaitReceived(emcCommandSerialNumber); -} - -static int iniLoad(const char *filename) -{ - IniFile inifile; - const char *inistring; - double d; - int i; - - // open it - if (inifile.Open(filename) == false) { - return -1; - } - - if (NULL != (inistring = inifile.Find("DEBUG", "EMC"))) { - // copy to global - if (1 != sscanf(inistring, "%i", &emc_debug)) { - emc_debug = 0; - } - } else { - // not found, use default - emc_debug = 0; - } - - if (NULL != (inistring = inifile.Find("NML_FILE", "EMC"))) { - // copy to global - strcpy(emc_nmlfile, inistring); - } else { - // not found, use default - } - - if (NULL != (inistring = inifile.Find("MAX_FEED_OVERRIDE", "DISPLAY"))) { - if (1 == sscanf(inistring, "%lf", &d) && d > 0.0) { - maxFeedOverride = d; - } - } - - if(inifile.Find(&maxMaxVelocity, "MAX_VELOCITY", "TRAJ") && - inifile.Find(&maxMaxVelocity, "MAX_VELOCITY", "AXIS_0")) - maxMaxVelocity = 1.0; - - if (NULL != (inistring = inifile.Find("MIN_SPINDLE_OVERRIDE", "DISPLAY"))) { - if (1 == sscanf(inistring, "%lf", &d) && d > 0.0) { - minSpindleOverride = d; - } - } - - if (NULL != (inistring = inifile.Find("MAX_SPINDLE_OVERRIDE", "DISPLAY"))) { - if (1 == sscanf(inistring, "%lf", &d) && d > 0.0) { - maxSpindleOverride = d; - } - } - - if (NULL != (inistring = inifile.Find("AXES", "TRAJ"))) { - if (1 == sscanf(inistring, "%d", &i) && i > 0) { - num_axes = i; - } - } - - if (NULL != inifile.Find("HOME_SEQUENCE", "AXIS_0")) { - have_home_all = 1; - } - - if (NULL != (inistring = inifile.Find("LINEAR_UNITS", "DISPLAY"))) { - if (!strcmp(inistring, "AUTO")) { - linearUnitConversion = LINEAR_UNITS_AUTO; - } else if (!strcmp(inistring, "INCH")) { - linearUnitConversion = LINEAR_UNITS_INCH; - } else if (!strcmp(inistring, "MM")) { - linearUnitConversion = LINEAR_UNITS_MM; - } else if (!strcmp(inistring, "CM")) { - linearUnitConversion = LINEAR_UNITS_CM; - } - } - - if (NULL != (inistring = inifile.Find("ANGULAR_UNITS", "DISPLAY"))) { - if (!strcmp(inistring, "AUTO")) { - angularUnitConversion = ANGULAR_UNITS_AUTO; - } else if (!strcmp(inistring, "DEG")) { - angularUnitConversion = ANGULAR_UNITS_DEG; - } else if (!strcmp(inistring, "RAD")) { - angularUnitConversion = ANGULAR_UNITS_RAD; - } else if (!strcmp(inistring, "GRAD")) { - angularUnitConversion = ANGULAR_UNITS_GRAD; - } - } - - const char *mc; - while(num_mdi_commands < MDI_MAX && (mc = inifile.Find("MDI_COMMAND", "HALUI", num_mdi_commands+1))) { - mdi_commands[num_mdi_commands++] = strdup(mc); - } - - // close it - inifile.Close(); - - return 0; -} - -static void hal_init_pins() -{ - int joint; - - *(halui_data->machine_on) = old_halui_data.machine_on = 0; - *(halui_data->machine_off) = old_halui_data.machine_off = 0; - - *(halui_data->estop_activate) = old_halui_data.estop_activate = 0; - *(halui_data->estop_reset) = old_halui_data.estop_reset = 0; - - - for (joint=0; joint < num_axes; joint++) { - *(halui_data->joint_home[joint]) = old_halui_data.joint_home[joint] = 0; - *(halui_data->joint_unhome[joint]) = old_halui_data.joint_unhome[joint] = 0; - *(halui_data->joint_nr_select[joint]) = old_halui_data.joint_nr_select[joint] = 0; - *(halui_data->jog_minus[joint]) = old_halui_data.jog_minus[joint] = 0; - *(halui_data->jog_plus[joint]) = old_halui_data.jog_plus[joint] = 0; - *(halui_data->jog_analog[joint]) = old_halui_data.jog_analog[joint] = 0; - *(halui_data->jog_increment[joint]) = old_halui_data.jog_increment[joint] = 0.0; - *(halui_data->jog_increment_plus[joint]) = old_halui_data.jog_increment_plus[joint] = 0; - *(halui_data->jog_increment_minus[joint]) = old_halui_data.jog_increment_minus[joint] = 0; - } - - *(halui_data->joint_home[num_axes]) = old_halui_data.joint_home[num_axes] = 0; - *(halui_data->jog_minus[num_axes]) = old_halui_data.jog_minus[num_axes] = 0; - *(halui_data->jog_plus[num_axes]) = old_halui_data.jog_plus[num_axes] = 0; - *(halui_data->jog_increment[num_axes]) = old_halui_data.jog_increment[num_axes] = 0.0; - *(halui_data->jog_increment_plus[num_axes]) = old_halui_data.jog_increment_plus[num_axes] = 0; - *(halui_data->jog_increment_minus[num_axes]) = old_halui_data.jog_increment_minus[num_axes] = 0; - *(halui_data->jog_deadband) = 0.2; - *(halui_data->jog_speed) = 0; - - *(halui_data->joint_selected) = 0; // select joint 0 by default - - *(halui_data->fo_scale) = old_halui_data.fo_scale = 0.1; //sane default - *(halui_data->ro_scale) = old_halui_data.ro_scale = 0.1; //sane default - *(halui_data->so_scale) = old_halui_data.so_scale = 0.1; //sane default -} - -static int check_bit_changed(bool halpin, bool &newpin) -{ - if (halpin != newpin) { - newpin = halpin; - return halpin; - } - return 0; -} - -static void copy_hal_data(const halui_str &i, local_halui_str &j) -{ - int x; -#define FIELD(t,f) j.f = (i.f)?*i.f:0; -#define ARRAY(t,f,n) do { for (x = 0; x < n; x++) j.f[x] = (i.f[x])?*i.f[x]:0; } while (0); - HAL_FIELDS -#undef FIELD -#undef ARRAY -} - -// this function looks if any of the hal pins has changed -// and sends appropiate messages if so -static void check_hal_changes() -{ - hal_s32_t counts; - int select_changed, joint; - hal_bit_t bit; - int js; - hal_float_t floatt; - int jog_speed_changed; - - local_halui_str new_halui_data_mutable; - copy_hal_data(*halui_data, new_halui_data_mutable); - const local_halui_str &new_halui_data = new_halui_data_mutable; - - - //check if machine_on pin has changed (the rest work exactly the same) - if (check_bit_changed(new_halui_data.machine_on, old_halui_data.machine_on) != 0) - sendMachineOn(); //send MachineOn NML command - - if (check_bit_changed(new_halui_data.machine_off, old_halui_data.machine_off) != 0) - sendMachineOff(); - - if (check_bit_changed(new_halui_data.estop_activate, old_halui_data.estop_activate) != 0) - sendEstop(); - - if (check_bit_changed(new_halui_data.estop_reset, old_halui_data.estop_reset) != 0) - sendEstopReset(); - - if (check_bit_changed(new_halui_data.mode_manual, old_halui_data.mode_manual) != 0) - sendManual(); - - if (check_bit_changed(new_halui_data.mode_auto, old_halui_data.mode_auto) != 0) - sendAuto(); - - if (check_bit_changed(new_halui_data.mode_mdi, old_halui_data.mode_mdi) != 0) - sendMdi(); - - if (check_bit_changed(new_halui_data.mode_teleop, old_halui_data.mode_teleop) != 0) - sendTeleop(); - - if (check_bit_changed(new_halui_data.mode_joint, old_halui_data.mode_joint) != 0) - sendJoint(); - - if (check_bit_changed(new_halui_data.mist_on, old_halui_data.mist_on) != 0) - sendMistOn(); - - if (check_bit_changed(new_halui_data.mist_off, old_halui_data.mist_off) != 0) - sendMistOff(); - - if (check_bit_changed(new_halui_data.flood_on, old_halui_data.flood_on) != 0) - sendFloodOn(); - - if (check_bit_changed(new_halui_data.flood_off, old_halui_data.flood_off) != 0) - sendFloodOff(); - - if (check_bit_changed(new_halui_data.lube_on, old_halui_data.lube_on) != 0) - sendLubeOn(); - - if (check_bit_changed(new_halui_data.lube_off, old_halui_data.lube_off) != 0) - sendLubeOff(); - - if (check_bit_changed(new_halui_data.program_run, old_halui_data.program_run) != 0) - sendProgramRun(0); - - if (check_bit_changed(new_halui_data.program_pause, old_halui_data.program_pause) != 0) - sendProgramPause(); - - if (check_bit_changed(new_halui_data.program_os_on, old_halui_data.program_os_on) != 0) - sendSetOptionalStop(ON); - - if (check_bit_changed(new_halui_data.program_os_off, old_halui_data.program_os_off) != 0) - sendSetOptionalStop(OFF); - - if (check_bit_changed(new_halui_data.program_bd_on, old_halui_data.program_bd_on) != 0) - sendSetBlockDelete(ON); - - if (check_bit_changed(new_halui_data.program_bd_off, old_halui_data.program_bd_off) != 0) - sendSetBlockDelete(OFF); - - if (check_bit_changed(new_halui_data.program_resume, old_halui_data.program_resume) != 0) - sendProgramResume(); - - if (check_bit_changed(new_halui_data.program_step, old_halui_data.program_step) != 0) - sendProgramStep(); - - if (check_bit_changed(new_halui_data.program_stop, old_halui_data.program_stop) != 0) - sendAbort(); - - //max-velocity stuff - counts = new_halui_data.mv_counts; - if (counts != old_halui_data.mv_counts) { - if (new_halui_data.mv_count_enable) { - if (new_halui_data.mv_direct_value) { - sendMaxVelocity(counts * new_halui_data.mv_scale); - } else { - sendMaxVelocity( new_halui_data.mv_value + (counts - old_halui_data.mv_counts) * - new_halui_data.mv_scale); - } - } - old_halui_data.mv_counts = counts; - } - - //feed-override stuff - counts = new_halui_data.fo_counts; - if (counts != old_halui_data.fo_counts) { - if (new_halui_data.fo_count_enable) { - if (new_halui_data.fo_direct_value) { - sendFeedOverride(counts * new_halui_data.fo_scale); - } else { - sendFeedOverride( new_halui_data.fo_value + (counts - old_halui_data.fo_counts) * - new_halui_data.fo_scale); - } - } - old_halui_data.fo_counts = counts; - } - - //rapid-override stuff - counts = new_halui_data.ro_counts; - if (counts != old_halui_data.ro_counts) { - if (new_halui_data.ro_count_enable) { - if (new_halui_data.ro_direct_value) { - sendRapidOverride(counts * new_halui_data.ro_scale); - } else { - sendRapidOverride( new_halui_data.ro_value + (counts - old_halui_data.ro_counts) * - new_halui_data.ro_scale); - } - } - old_halui_data.ro_counts = counts; - } - - //spindle-override stuff - counts = new_halui_data.so_counts; - if (counts != old_halui_data.so_counts) { - if (new_halui_data.so_count_enable) { - if (new_halui_data.so_direct_value) { - sendSpindleOverride(counts * new_halui_data.so_scale); - } else { - sendSpindleOverride( new_halui_data.so_value + (counts - old_halui_data.so_counts) * - new_halui_data.so_scale); - } - } - old_halui_data.so_counts = counts; - } - - if (check_bit_changed(new_halui_data.mv_increase, old_halui_data.mv_increase) != 0) - sendMaxVelocity(new_halui_data.mv_value + new_halui_data.mv_scale); - if (check_bit_changed(new_halui_data.mv_decrease, old_halui_data.mv_decrease) != 0) - sendMaxVelocity(new_halui_data.mv_value - new_halui_data.mv_scale); - - if (check_bit_changed(new_halui_data.fo_increase, old_halui_data.fo_increase) != 0) - sendFeedOverride(new_halui_data.fo_value + new_halui_data.fo_scale); - if (check_bit_changed(new_halui_data.fo_decrease, old_halui_data.fo_decrease) != 0) - sendFeedOverride(new_halui_data.fo_value - new_halui_data.fo_scale); - - if (check_bit_changed(new_halui_data.ro_increase, old_halui_data.ro_increase) != 0) - sendRapidOverride(new_halui_data.ro_value + new_halui_data.ro_scale); - if (check_bit_changed(new_halui_data.ro_decrease, old_halui_data.ro_decrease) != 0) - sendRapidOverride(new_halui_data.ro_value - new_halui_data.ro_scale); - - - if (check_bit_changed(new_halui_data.so_increase, old_halui_data.so_increase) != 0) - sendSpindleOverride(new_halui_data.so_value + new_halui_data.so_scale); - if (check_bit_changed(new_halui_data.so_decrease, old_halui_data.so_decrease) != 0) - sendSpindleOverride(new_halui_data.so_value - new_halui_data.so_scale); - -//spindle stuff - if (check_bit_changed(new_halui_data.spindle_start, old_halui_data.spindle_start) != 0) - sendSpindleForward(); - - if (check_bit_changed(new_halui_data.spindle_stop, old_halui_data.spindle_stop) != 0) - sendSpindleOff(); - - if (check_bit_changed(new_halui_data.spindle_forward, old_halui_data.spindle_forward) != 0) - sendSpindleForward(); - - if (check_bit_changed(new_halui_data.spindle_reverse, old_halui_data.spindle_reverse) != 0) - sendSpindleReverse(); - - bit = new_halui_data.spindle_increase; - if (bit != old_halui_data.spindle_increase) { - if (bit != 0) - sendSpindleIncrease(); - if (bit == 0) - sendSpindleConstant(); - old_halui_data.spindle_increase = bit; - } - - bit = new_halui_data.spindle_decrease; - if (bit != old_halui_data.spindle_decrease) { - if (bit != 0) - sendSpindleDecrease(); - if (bit == 0) - sendSpindleConstant(); - old_halui_data.spindle_decrease = bit; - } - - if (check_bit_changed(new_halui_data.spindle_brake_on, old_halui_data.spindle_brake_on) != 0) - sendBrakeEngage(); - - if (check_bit_changed(new_halui_data.spindle_brake_off, old_halui_data.spindle_brake_off) != 0) - sendBrakeRelease(); - - if (check_bit_changed(new_halui_data.abort, old_halui_data.abort) != 0) - sendAbort(); - - if (check_bit_changed(new_halui_data.home_all, old_halui_data.home_all) != 0) - sendHome(-1); - -// joint stuff (selection, homing..) - select_changed = -1; // flag to see if the selected joint changed - - // if the jog-speed changes while in a continuous jog, we want to - // re-start the jog with the new speed - if (rtapi_fabs(old_halui_data.jog_speed - new_halui_data.jog_speed) > 0.00001) { - old_halui_data.jog_speed = new_halui_data.jog_speed; - jog_speed_changed = 1; - } else { - jog_speed_changed = 0; - } - - - for (joint=0; joint < num_axes; joint++) { - if (check_bit_changed(new_halui_data.joint_home[joint], old_halui_data.joint_home[joint]) != 0) - sendHome(joint); - - if (check_bit_changed(new_halui_data.joint_unhome[joint], old_halui_data.joint_unhome[joint]) != 0) - sendUnhome(joint); - - bit = new_halui_data.jog_minus[joint]; - if ((bit != old_halui_data.jog_minus[joint]) || (bit && jog_speed_changed)) { - if (bit != 0) - sendJogCont(joint,-new_halui_data.jog_speed); - else - sendJogStop(joint); - old_halui_data.jog_minus[joint] = bit; - } - - bit = new_halui_data.jog_plus[joint]; - if ((bit != old_halui_data.jog_plus[joint]) || (bit && jog_speed_changed)) { - if (bit != 0) - sendJogCont(joint,new_halui_data.jog_speed); - else - sendJogStop(joint); - old_halui_data.jog_plus[joint] = bit; - } - - floatt = new_halui_data.jog_analog[joint]; - bit = (rtapi_fabs(floatt) > new_halui_data.jog_deadband); - if ((floatt != old_halui_data.jog_analog[joint]) || (bit && jog_speed_changed)) { - if (bit) - sendJogCont(joint,(new_halui_data.jog_speed) * (new_halui_data.jog_analog[joint])); - else - sendJogStop(joint); - old_halui_data.jog_analog[joint] = floatt; - } - - bit = new_halui_data.jog_increment_plus[joint]; - if (bit != old_halui_data.jog_increment_plus[joint]) { - if (bit) - sendJogInc(joint, new_halui_data.jog_speed, new_halui_data.jog_increment[joint]); - old_halui_data.jog_increment_plus[joint] = bit; - } - - bit = new_halui_data.jog_increment_minus[joint]; - if (bit != old_halui_data.jog_increment_minus[joint]) { - if (bit) - sendJogInc(joint, new_halui_data.jog_speed, -(new_halui_data.jog_increment[joint])); - old_halui_data.jog_increment_minus[joint] = bit; - } - - // check to see if another joint has been selected - bit = new_halui_data.joint_nr_select[joint]; - if (bit != old_halui_data.joint_nr_select[joint]) { - if (bit != 0) { - *halui_data->joint_selected = joint; - select_changed = joint; // flag that we changed the selected joint - } - old_halui_data.joint_home[joint] = bit; - } - } - - if (select_changed >= 0) { - for (joint = 0; joint < num_axes; joint++) { - if (joint != select_changed) { - *(halui_data->joint_is_selected[joint]) = 0; - } else { - *(halui_data->joint_is_selected[joint]) = 1; - } - } - } - - if (check_bit_changed(new_halui_data.joint_home[num_axes], old_halui_data.joint_home[num_axes]) != 0) - sendHome(new_halui_data.joint_selected); - - if (check_bit_changed(new_halui_data.joint_unhome[num_axes], old_halui_data.joint_unhome[num_axes]) != 0) - sendUnhome(new_halui_data.joint_selected); - - bit = new_halui_data.jog_minus[num_axes]; - js = new_halui_data.joint_selected; - if ((bit != old_halui_data.jog_minus[num_axes]) || (bit && jog_speed_changed)) { - if (bit != 0) - sendJogCont(js, -new_halui_data.jog_speed); - else - sendJogStop(js); - old_halui_data.jog_minus[num_axes] = bit; - } - - bit = new_halui_data.jog_plus[num_axes]; - js = new_halui_data.joint_selected; - if ((bit != old_halui_data.jog_plus[num_axes]) || (bit && jog_speed_changed)) { - if (bit != 0) - sendJogCont(js,new_halui_data.jog_speed); - else - sendJogStop(js); - old_halui_data.jog_plus[num_axes] = bit; - } - - bit = new_halui_data.jog_increment_plus[num_axes]; - js = new_halui_data.joint_selected; - if (bit != old_halui_data.jog_increment_plus[num_axes]) { - if (bit) - sendJogInc(js, new_halui_data.jog_speed, new_halui_data.jog_increment[num_axes]); - old_halui_data.jog_increment_plus[num_axes] = bit; - } - - bit = new_halui_data.jog_increment_minus[num_axes]; - js = new_halui_data.joint_selected; - if (bit != old_halui_data.jog_increment_minus[num_axes]) { - if (bit) - sendJogInc(js, new_halui_data.jog_speed, -(new_halui_data.jog_increment[num_axes])); - old_halui_data.jog_increment_minus[num_axes] = bit; - } - - for(int n = 0; n < num_mdi_commands; n++) { - if (check_bit_changed(new_halui_data.mdi_commands[n], old_halui_data.mdi_commands[n]) != 0) - sendMdiCommand(n); - } -} - -// this function looks at the received NML status message -// and modifies the appropiate HAL pins -static void modify_hal_pins() -{ - int joint; - - if (emcStatus->task.state == EMC_TASK_STATE_ON) { - *(halui_data->machine_is_on)=1; - } else { - *(halui_data->machine_is_on)=0; - } - - if (emcStatus->task.state == EMC_TASK_STATE_ESTOP) { - *(halui_data->estop_is_activated)=1; - } else { - *(halui_data->estop_is_activated)=0; - } - - if (halui_sent_mdi) { // we have an ongoing MDI command - if (emcStatus->status == 1) { //which seems to have finished - halui_sent_mdi = 0; - switch (halui_old_mode) { - case EMC_TASK_MODE_MANUAL: sendManual();break; - case EMC_TASK_MODE_MDI: break; - case EMC_TASK_MODE_AUTO: sendAuto();break; - default: sendManual();break; - } - } - } - - - if (emcStatus->task.mode == EMC_TASK_MODE_MANUAL) { - *(halui_data->mode_is_manual)=1; - } else { - *(halui_data->mode_is_manual)=0; - } - - if (emcStatus->task.mode == EMC_TASK_MODE_AUTO) { - *(halui_data->mode_is_auto)=1; - } else { - *(halui_data->mode_is_auto)=0; - } - - if (emcStatus->task.mode == EMC_TASK_MODE_MDI) { - *(halui_data->mode_is_mdi)=1; - } else { - *(halui_data->mode_is_mdi)=0; - } - - if (emcStatus->motion.traj.mode == EMC_TRAJ_MODE_TELEOP) { - *(halui_data->mode_is_teleop)=1; - } else { - *(halui_data->mode_is_teleop)=0; - } - - if (emcStatus->motion.traj.mode == EMC_TRAJ_MODE_TELEOP) { - *(halui_data->mode_is_joint)=0; - } else { - *(halui_data->mode_is_joint)=1; - } - - *(halui_data->program_is_paused) = emcStatus->task.interpState == EMC_TASK_INTERP_PAUSED; - *(halui_data->program_is_running) = emcStatus->task.interpState == EMC_TASK_INTERP_READING || - emcStatus->task.interpState == EMC_TASK_INTERP_WAITING; - *(halui_data->program_is_idle) = emcStatus->task.interpState == EMC_TASK_INTERP_IDLE; - *(halui_data->program_os_is_on) = emcStatus->task.optional_stop_state; - *(halui_data->program_bd_is_on) = emcStatus->task.block_delete_state; - - *(halui_data->mv_value) = emcStatus->motion.traj.maxVelocity; - *(halui_data->fo_value) = emcStatus->motion.traj.scale; //feedoverride from 0 to 1 for 100% - *(halui_data->ro_value) = emcStatus->motion.traj.rapid_scale; //rapid override from 0 to 1 for 100% - *(halui_data->so_value) = emcStatus->motion.traj.spindle_scale; //spindle-speed-override from 0 to 1 for 100% - - *(halui_data->mist_is_on) = emcStatus->io.coolant.mist; - *(halui_data->flood_is_on) = emcStatus->io.coolant.flood; - *(halui_data->lube_is_on) = emcStatus->io.lube.on; - - *(halui_data->tool_number) = emcStatus->io.tool.toolInSpindle; - *(halui_data->tool_length_offset_x) = emcStatus->task.toolOffset.tran.x; - *(halui_data->tool_length_offset_y) = emcStatus->task.toolOffset.tran.y; - *(halui_data->tool_length_offset_z) = emcStatus->task.toolOffset.tran.z; - *(halui_data->tool_length_offset_a) = emcStatus->task.toolOffset.a; - *(halui_data->tool_length_offset_b) = emcStatus->task.toolOffset.b; - *(halui_data->tool_length_offset_c) = emcStatus->task.toolOffset.c; - *(halui_data->tool_length_offset_u) = emcStatus->task.toolOffset.u; - *(halui_data->tool_length_offset_v) = emcStatus->task.toolOffset.v; - *(halui_data->tool_length_offset_w) = emcStatus->task.toolOffset.w; - - *(halui_data->spindle_is_on) = (emcStatus->motion.spindle.speed != 0); - *(halui_data->spindle_runs_forward) = (emcStatus->motion.spindle.direction == 1); - *(halui_data->spindle_runs_backward) = (emcStatus->motion.spindle.direction == -1); - *(halui_data->spindle_brake_is_on) = emcStatus->motion.spindle.brake; - - for (joint=0; joint < num_axes; joint++) { - *(halui_data->joint_is_homed[joint]) = emcStatus->motion.axis[joint].homed; - *(halui_data->joint_on_soft_min_limit[joint]) = emcStatus->motion.axis[joint].minSoftLimit; - *(halui_data->joint_on_soft_max_limit[joint]) = emcStatus->motion.axis[joint].maxSoftLimit; - *(halui_data->joint_on_hard_min_limit[joint]) = emcStatus->motion.axis[joint].minHardLimit; - *(halui_data->joint_on_hard_max_limit[joint]) = emcStatus->motion.axis[joint].maxHardLimit; - *(halui_data->joint_has_fault[joint]) = emcStatus->motion.axis[joint].fault; - } - - *(halui_data->axis_pos_commanded[0]) = emcStatus->motion.traj.position.tran.x; - *(halui_data->axis_pos_commanded[1]) = emcStatus->motion.traj.position.tran.y; - *(halui_data->axis_pos_commanded[2]) = emcStatus->motion.traj.position.tran.z; - *(halui_data->axis_pos_commanded[3]) = emcStatus->motion.traj.position.a; - *(halui_data->axis_pos_commanded[4]) = emcStatus->motion.traj.position.b; - *(halui_data->axis_pos_commanded[5]) = emcStatus->motion.traj.position.c; - *(halui_data->axis_pos_commanded[6]) = emcStatus->motion.traj.position.u; - *(halui_data->axis_pos_commanded[7]) = emcStatus->motion.traj.position.v; - *(halui_data->axis_pos_commanded[8]) = emcStatus->motion.traj.position.w; - *(halui_data->axis_pos_feedback[0]) = emcStatus->motion.traj.actualPosition.tran.x; - *(halui_data->axis_pos_feedback[1]) = emcStatus->motion.traj.actualPosition.tran.y; - *(halui_data->axis_pos_feedback[2]) = emcStatus->motion.traj.actualPosition.tran.z; - *(halui_data->axis_pos_feedback[3]) = emcStatus->motion.traj.actualPosition.a; - *(halui_data->axis_pos_feedback[4]) = emcStatus->motion.traj.actualPosition.b; - *(halui_data->axis_pos_feedback[5]) = emcStatus->motion.traj.actualPosition.c; - *(halui_data->axis_pos_feedback[6]) = emcStatus->motion.traj.actualPosition.u; - *(halui_data->axis_pos_feedback[7]) = emcStatus->motion.traj.actualPosition.v; - *(halui_data->axis_pos_feedback[8]) = emcStatus->motion.traj.actualPosition.w; - *(halui_data->axis_pos_relative[0]) = emcStatus->motion.traj.actualPosition.tran.x - emcStatus->task.g5x_offset.tran.x - emcStatus->task.g92_offset.tran.x - emcStatus->task.toolOffset.tran.x; - *(halui_data->axis_pos_relative[1]) = emcStatus->motion.traj.actualPosition.tran.y - emcStatus->task.g5x_offset.tran.y - emcStatus->task.g92_offset.tran.y - emcStatus->task.toolOffset.tran.y; - *(halui_data->axis_pos_relative[2]) = emcStatus->motion.traj.actualPosition.tran.z - emcStatus->task.g5x_offset.tran.z - emcStatus->task.g92_offset.tran.z - emcStatus->task.toolOffset.tran.z; - *(halui_data->axis_pos_relative[3]) = emcStatus->motion.traj.actualPosition.a - emcStatus->task.g5x_offset.a - emcStatus->task.g92_offset.a - emcStatus->task.toolOffset.a; - *(halui_data->axis_pos_relative[4]) = emcStatus->motion.traj.actualPosition.b - emcStatus->task.g5x_offset.b - emcStatus->task.g92_offset.b - emcStatus->task.toolOffset.b; - *(halui_data->axis_pos_relative[5]) = emcStatus->motion.traj.actualPosition.c - emcStatus->task.g5x_offset.c - emcStatus->task.g92_offset.c - emcStatus->task.toolOffset.c; - *(halui_data->axis_pos_relative[6]) = emcStatus->motion.traj.actualPosition.u - emcStatus->task.g5x_offset.u - emcStatus->task.g92_offset.u - emcStatus->task.toolOffset.u; - *(halui_data->axis_pos_relative[7]) = emcStatus->motion.traj.actualPosition.v - emcStatus->task.g5x_offset.v - emcStatus->task.g92_offset.v - emcStatus->task.toolOffset.v; - *(halui_data->axis_pos_relative[8]) = emcStatus->motion.traj.actualPosition.w - emcStatus->task.g5x_offset.w - emcStatus->task.g92_offset.w - emcStatus->task.toolOffset.w; - - *(halui_data->joint_is_homed[num_axes]) = emcStatus->motion.axis[*(halui_data->joint_selected)].homed; - *(halui_data->joint_on_soft_min_limit[num_axes]) = emcStatus->motion.axis[*(halui_data->joint_selected)].minSoftLimit; - *(halui_data->joint_on_soft_max_limit[num_axes]) = emcStatus->motion.axis[*(halui_data->joint_selected)].maxSoftLimit; - *(halui_data->joint_on_hard_min_limit[num_axes]) = emcStatus->motion.axis[*(halui_data->joint_selected)].minHardLimit; - *(halui_data->joint_on_hard_max_limit[num_axes]) = emcStatus->motion.axis[*(halui_data->joint_selected)].maxHardLimit; - *(halui_data->joint_has_fault[num_axes]) = emcStatus->motion.axis[*(halui_data->joint_selected)].fault; - -} - - - -int main(int argc, char *argv[]) -{ - // process command line args - if (0 != emcGetArgs(argc, argv)) { - rcs_print_error("error in argument list\n"); - exit(1); - } - - // get configuration information - if (0 != iniLoad(emc_inifile)) { - rcs_print_error("iniLoad error\n"); - exit(2); - } - - //init HAL and export pins - if (0 != halui_hal_init()) { - rcs_print_error("hal_init error\n"); - exit(1); - } - - //initialize safe values - hal_init_pins(); - - // init NML - if (0 != tryNml()) { - rcs_print_error("can't connect to emc\n"); - thisQuit(); - exit(1); - } - - // get current serial number, and save it for restoring when we quit - // so as not to interfere with real operator interface - updateStatus(); - - done = 0; - /* Register the routine that catches the SIGINT signal */ - signal(SIGINT, quit); - /* catch SIGTERM too - the run script uses it to shut things down */ - signal(SIGTERM, quit); - - while (!done) { - - check_hal_changes(); //if anything changed send NML messages - - modify_hal_pins(); //if status changed modify HAL too - - esleep(0.02); //sleep for a while - - updateStatus(); - } - thisQuit(); - return 0; -} diff --git a/src/emc/usr_intf/keystick.cc b/src/emc/usr_intf/keystick.cc index 74cf62762..29fc2ad64 100644 --- a/src/emc/usr_intf/keystick.cc +++ b/src/emc/usr_intf/keystick.cc @@ -23,15 +23,15 @@ #include // ioctl(), TIOCGWINSZ, struct winsize #include // STDIN_FILENO -#include "rcs.hh" // rcs_print_error(), esleep() -#include "emc.hh" // EMC NML -#include "emc_nml.hh" -#include "emcglb.h" // EMC_NMLFILE, TRAJ_MAX_VELOCITY -#include "emccfg.h" // DEFAULT_TRAJ_MAX_VELOCITY -#include "inifile.hh" // INIFILE -#include "rcs_print.hh" -#include "nml_oi.hh" -#include "timer.hh" +#include // rcs_print_error(), esleep() +#include // EMC NML +#include +#include // EMC_NMLFILE, TRAJ_MAX_VELOCITY +#include // DEFAULT_TRAJ_MAX_VELOCITY +#include // INIFILE +#include +#include +#include #include #define ESC 27 diff --git a/src/emc/usr_intf/pncconf/CMakeLists.txt b/src/emc/usr_intf/pncconf/CMakeLists.txt new file mode 100644 index 000000000..89c395d33 --- /dev/null +++ b/src/emc/usr_intf/pncconf/CMakeLists.txt @@ -0,0 +1,38 @@ +cmake_minimum_required(VERSION 2.8) +set (project pncconf) + +set(GLADES + pncconf.glade +) + +install( + FILES ${GLADES} + DESTINATION share/machinekit +) + +# Note, needs python-gobject-2-dev, python-gtk2, python-glade2 + +# Check syntax of pncconf +add_custom_command( + OUTPUT ${project}.pyc + COMMAND ${Python2_Interp} -m py_compile ${project}.py + DEPENDS ${project}.py + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +) + +# Stage pncconf executable for installation +add_custom_target(${project} + COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/${project}.py ${project} + DEPENDS ${project}.pyc + VERBATIM + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +) + +install( + FILES "${project}.py" + DESTINATION bin + RENAME ${project} +) + +# TODO - not sure how to handle I18N stuff yet +# PYI18NSRCS += emc/usr_intf/pncconf/pncconf.py emc/usr_intf/pncconf/pncconf.glade diff --git a/src/emc/usr_intf/pncconf/pncconf-help/CMakeLists.txt b/src/emc/usr_intf/pncconf/pncconf-help/CMakeLists.txt new file mode 100644 index 000000000..4be3ead80 --- /dev/null +++ b/src/emc/usr_intf/pncconf/pncconf-help/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8) +set (project pncconf-help) + diff --git a/src/emc/usr_intf/rtapi_app.h b/src/emc/usr_intf/rtapi_app.h deleted file mode 120000 index 44c07b6c3..000000000 --- a/src/emc/usr_intf/rtapi_app.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_app.h \ No newline at end of file diff --git a/src/emc/usr_intf/rtapi_errno.h b/src/emc/usr_intf/rtapi_errno.h deleted file mode 120000 index a7c499fbe..000000000 --- a/src/emc/usr_intf/rtapi_errno.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_errno.h \ No newline at end of file diff --git a/src/emc/usr_intf/rtapi_exception.h b/src/emc/usr_intf/rtapi_exception.h deleted file mode 120000 index b36191755..000000000 --- a/src/emc/usr_intf/rtapi_exception.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_exception.h \ No newline at end of file diff --git a/src/emc/usr_intf/rtapi_global.h b/src/emc/usr_intf/rtapi_global.h deleted file mode 120000 index 6dd28b7aa..000000000 --- a/src/emc/usr_intf/rtapi_global.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_global.h \ No newline at end of file diff --git a/src/emc/usr_intf/rtapi_heap.h b/src/emc/usr_intf/rtapi_heap.h deleted file mode 120000 index c43e557ad..000000000 --- a/src/emc/usr_intf/rtapi_heap.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_heap.h \ No newline at end of file diff --git a/src/emc/usr_intf/rtapi_heap_private.h b/src/emc/usr_intf/rtapi_heap_private.h deleted file mode 120000 index 09d0c0749..000000000 --- a/src/emc/usr_intf/rtapi_heap_private.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_heap_private.h \ No newline at end of file diff --git a/src/emc/usr_intf/rtapi_math.h b/src/emc/usr_intf/rtapi_math.h deleted file mode 120000 index cdb837d6c..000000000 --- a/src/emc/usr_intf/rtapi_math.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_math.h \ No newline at end of file diff --git a/src/emc/usr_intf/schedrmt.cc b/src/emc/usr_intf/schedrmt.cc index 941f245c3..a8cbac05c 100644 --- a/src/emc/usr_intf/schedrmt.cc +++ b/src/emc/usr_intf/schedrmt.cc @@ -14,7 +14,9 @@ * Last change: ********************************************************************/ +#ifndef _REENTRANT #define _REENTRANT +#endif #include #include @@ -22,7 +24,7 @@ #include #include #include -#include "rtapi_math.h" +#include #include #include #include @@ -32,15 +34,15 @@ #include -#include "rcs.hh" -#include "posemath.h" // PM_POSE, TO_RAD -#include "emc.hh" // EMC NML -#include "canon.hh" // CANON_UNITS, CANON_UNITS_INCHES,MM,CM -#include "emcglb.h" // EMC_NMLFILE, TRAJ_MAX_VELOCITY, etc. -#include "emccfg.h" // DEFAULT_TRAJ_MAX_VELOCITY -#include "inifile.hh" // INIFILE -#include "rcs_print.hh" -#include "timer.hh" // etime() +#include +#include // PM_POSE, TO_RAD +#include // EMC NML +#include // CANON_UNITS, CANON_UNITS_INCHES,MM,CM +#include // EMC_NMLFILE, TRAJ_MAX_VELOCITY, etc. +#include // DEFAULT_TRAJ_MAX_VELOCITY +#include // INIFILE +#include +#include // etime() #include "shcom.hh" // NML Messaging functions #include "emcsched.hh" diff --git a/src/emc/usr_intf/shcom.cc b/src/emc/usr_intf/shcom.cc index 03252e36b..ecfa4a0b5 100644 --- a/src/emc/usr_intf/shcom.cc +++ b/src/emc/usr_intf/shcom.cc @@ -20,20 +20,20 @@ #include #include #include -#include "rtapi_math.h" +#include #include -#include "rcs.hh" -#include "posemath.h" // PM_POSE, TO_RAD -#include "emc.hh" // EMC NML -#include "emc_nml.hh" -#include "canon.hh" // CANON_UNITS, CANON_UNITS_INCHES,MM,CM -#include "emcglb.h" // EMC_NMLFILE, TRAJ_MAX_VELOCITY, etc. -#include "emccfg.h" // DEFAULT_TRAJ_MAX_VELOCITY -#include "inifile.hh" // INIFILE -#include "nml_oi.hh" // nmlErrorFormat, NML_ERROR, etc -#include "rcs_print.hh" -#include "timer.hh" // esleep +#include +#include // PM_POSE, TO_RAD +#include // EMC NML +#include +#include // CANON_UNITS, CANON_UNITS_INCHES,MM,CM +#include // EMC_NMLFILE, TRAJ_MAX_VELOCITY, etc. +#include // DEFAULT_TRAJ_MAX_VELOCITY +#include // INIFILE +#include // nmlErrorFormat, NML_ERROR, etc +#include +#include // esleep #include "shcom.hh" // Common NML communications functions LINEAR_UNIT_CONVERSION linearUnitConversion; diff --git a/src/emc/usr_intf/shcom.hh b/src/emc/usr_intf/shcom.hh index ebae5a0eb..db5e8a596 100644 --- a/src/emc/usr_intf/shcom.hh +++ b/src/emc/usr_intf/shcom.hh @@ -17,8 +17,8 @@ #ifndef SHCOM_HH #define SHCOM_HH -#include "emc_nml.hh" -#include "nml_oi.hh" // NML_ERROR_LEN +#include +#include // NML_ERROR_LEN #define CLOSE(a,b,eps) ((a)-(b) < +(eps) && (a)-(b) > -(eps)) #define LINEAR_CLOSENESS 0.0001 diff --git a/src/emc/usr_intf/sockets.c b/src/emc/usr_intf/sockets.c index 836c4b466..fce1f0375 100644 --- a/src/emc/usr_intf/sockets.c +++ b/src/emc/usr_intf/sockets.c @@ -13,7 +13,7 @@ * Last change: ********************************************************************/ -#include "config.h" +#include #include #include #include @@ -35,7 +35,7 @@ #include #include -#include "rcs_print.hh" +#include #include "sockets.h" /************************************************** diff --git a/src/emc/usr_intf/sockets.h b/src/emc/usr_intf/sockets.h index e113d4da0..107af8c60 100644 --- a/src/emc/usr_intf/sockets.h +++ b/src/emc/usr_intf/sockets.h @@ -23,7 +23,7 @@ #include #ifdef HAVE_CONFIG_H -# include "config.h" +# include #endif #ifndef LCDPORT diff --git a/src/emc/usr_intf/stepconf/CMakeLists.txt b/src/emc/usr_intf/stepconf/CMakeLists.txt new file mode 100644 index 000000000..aa2d1e458 --- /dev/null +++ b/src/emc/usr_intf/stepconf/CMakeLists.txt @@ -0,0 +1,85 @@ +cmake_minimum_required(VERSION 3.12) +set (project stepconf) + +set(GLADES + ${CMAKE_CURRENT_SOURCE_DIR}/main_page.glade + ${CMAKE_CURRENT_SOURCE_DIR}/base.glade + ${CMAKE_CURRENT_SOURCE_DIR}/start.glade + ${CMAKE_CURRENT_SOURCE_DIR}/pport1.glade + ${CMAKE_CURRENT_SOURCE_DIR}/pport2.glade + ${CMAKE_CURRENT_SOURCE_DIR}/spindle.glade + ${CMAKE_CURRENT_SOURCE_DIR}/options.glade + ${CMAKE_CURRENT_SOURCE_DIR}/axisx.glade + ${CMAKE_CURRENT_SOURCE_DIR}/axisy.glade + ${CMAKE_CURRENT_SOURCE_DIR}/axisz.glade + ${CMAKE_CURRENT_SOURCE_DIR}/axisa.glade + ${CMAKE_CURRENT_SOURCE_DIR}/finished.glade +) + +install( + FILES ${GLADES} + DESTINATION share/machinekit/${project} +) + +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/__init__.py "") + +set(STEPCONF_MODULES + ${CMAKE_CURRENT_SOURCE_DIR}/pages + ${CMAKE_CURRENT_SOURCE_DIR}/build_INI + ${CMAKE_CURRENT_SOURCE_DIR}/build_HAL + ${CMAKE_CURRENT_BINARY_DIR}/__init__ +) + +# Check syntax of modules +foreach(module ${STEPCONF_MODULES}) + add_custom_command( + OUTPUT "${module}.pyc" + COMMAND ${Python2_Interp} -m py_compile "${module}.py" + DEPENDS "${module}.py" + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) +endforeach() + +list(TRANSFORM STEPCONF_MODULES APPEND ".py") + +install( + FILES ${STEPCONF_MODULES} + DESTINATION ${Python2_SITELIB}/${project} +) + +# Check syntax of stepconf +add_custom_command( + OUTPUT ${project}.pyc + COMMAND ${Python2_Interp} -m py_compile ${project}.py + DEPENDS ${project}.py + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +) + +# Stage stepconf executable for installation +add_custom_target(${project} + COMMAND cp "${CMAKE_CURRENT_SOURCE_DIR}/${project}.py" ${project} + DEPENDS ${project}.pyc + VERBATIM + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +) + +install( + FILES "${project}.py" + DESTINATION bin + RENAME ${project} +) + +# TODO - not sure how to handle I18N stuff yet +#PYI18NSRCS += emc/usr_intf/stepconf/stepconf.py $(patsubst %,emc/usr_intf/stepconf/%.py,$(STEPCONF_MODULES)) \ +# emc/usr_intf/stepconf/main_page.glade \ +# emc/usr_intf/stepconf/base.glade \ +# emc/usr_intf/stepconf/start.glade \ +# emc/usr_intf/stepconf/pport1.glade \ +# emc/usr_intf/stepconf/pport2.glade \ +# emc/usr_intf/stepconf/spindle.glade \ +# emc/usr_intf/stepconf/options.glade \ +# emc/usr_intf/stepconf/axisx.glade \ +# emc/usr_intf/stepconf/axisy.glade \ +# emc/usr_intf/stepconf/axisz.glade \ +# emc/usr_intf/stepconf/axisa.glade \ +# emc/usr_intf/stepconf/finished.glade diff --git a/src/emc/usr_intf/touchy/CMakeLists.txt b/src/emc/usr_intf/touchy/CMakeLists.txt new file mode 100644 index 000000000..c8811f875 --- /dev/null +++ b/src/emc/usr_intf/touchy/CMakeLists.txt @@ -0,0 +1,63 @@ +cmake_minimum_required(VERSION 3.12) +set (project touchy) + +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/__init__.py "") + +set(TOUCHY_MODULES + ${CMAKE_CURRENT_SOURCE_DIR}/mdi + ${CMAKE_CURRENT_SOURCE_DIR}/emc_interface + ${CMAKE_CURRENT_SOURCE_DIR}/hal_interface + ${CMAKE_CURRENT_SOURCE_DIR}/filechooser + ${CMAKE_CURRENT_SOURCE_DIR}/listing + ${CMAKE_CURRENT_SOURCE_DIR}/preferences + ${CMAKE_CURRENT_BINARY_DIR}/__init__ +) + +# Check syntax of modules +foreach(module ${TOUCHY_MODULES}) + add_custom_command( + OUTPUT "${module}.pyc" + COMMAND ${Python2_Interp} -m py_compile "${module}.py" + DEPENDS "${module}.py" + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) +endforeach() + +list(TRANSFORM TOUCHY_MODULES APPEND ".py") + +install( + FILES ${TOUCHY_MODULES} + DESTINATION ${Python2_SITELIB}/${project} +) + +# Check syntax of touchy +add_custom_command( + OUTPUT ${project}.pyc + COMMAND ${Python2_Interp} -m py_compile ${project}.py + DEPENDS ${project}.py + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +) + +# Stage touchy executable for installation +add_custom_target(${project} + COMMAND cp "${CMAKE_CURRENT_SOURCE_DIR}/${project}.py" ${project} + DEPENDS ${project}.pyc + VERBATIM + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +) + +install( + FILES "${project}.py" + DESTINATION bin + RENAME ${project} +) + +install( + FILES ${CMAKE_CURRENT_SOURCE_DIR}/touchy.glade + DESTINATION share/machinekit +) + +# TODO - not sure how to handle I18N stuff yet +#PYI18NSRCS += emc/usr_intf/touchy/touchy.py $(patsubst %,emc/usr_intf/touchy/%.py,$(TOUCHY_MODULES)) \ +# emc/usr_intf/touchy/touchy.glade + diff --git a/src/emc/usr_intf/xemc.cc b/src/emc/usr_intf/xemc.cc index 9812f4fac..84ae9fa1f 100644 --- a/src/emc/usr_intf/xemc.cc +++ b/src/emc/usr_intf/xemc.cc @@ -26,15 +26,15 @@ #include #include // O_CREAT -#include "rcs.hh" // etime() -#include "emc.hh" // EMC NML -#include "emc_nml.hh" -#include "emcglb.h" // EMC_NMLFILE, TRAJ_MAX_VELOCITY, TOOL_TABLE_FILE -#include "emccfg.h" // DEFAULT_TRAJ_MAX_VELOCITY -#include "inifile.hh" // INIFILE -#include "rcs_print.hh" -#include "nml_oi.hh" -#include "timer.hh" +#include // etime() +#include // EMC NML +#include +#include // EMC_NMLFILE, TRAJ_MAX_VELOCITY, TOOL_TABLE_FILE +#include // DEFAULT_TRAJ_MAX_VELOCITY +#include // INIFILE +#include +#include +#include /* * Include files required for all Toolkit programs diff --git a/src/libnml/CMakeLists.txt b/src/libnml/CMakeLists.txt new file mode 100644 index 000000000..8183c4bd4 --- /dev/null +++ b/src/libnml/CMakeLists.txt @@ -0,0 +1,23 @@ +set (project nml) + +add_subdirectory(buffer) +add_subdirectory(cms) +add_subdirectory(linklist) +add_subdirectory(nml) +add_subdirectory(rcs) +add_subdirectory(os_intf) + +add_library(${project} SHARED + $ + $ + $ + $ + $ + $ +) + +target_link_libraries(${project} rtapi_math) + +install(TARGETS ${project} + LIBRARY DESTINATION lib +) diff --git a/src/libnml/buffer/CMakeLists.txt b/src/libnml/buffer/CMakeLists.txt new file mode 100644 index 000000000..4ec3476a8 --- /dev/null +++ b/src/libnml/buffer/CMakeLists.txt @@ -0,0 +1,30 @@ +cmake_minimum_required(VERSION 2.8) +set (project buffer) + +set(${project}_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/locmem.cc + ${CMAKE_CURRENT_SOURCE_DIR}/memsem.cc + ${CMAKE_CURRENT_SOURCE_DIR}/phantom.cc + ${CMAKE_CURRENT_SOURCE_DIR}/physmem.cc + ${CMAKE_CURRENT_SOURCE_DIR}/recvn.c + ${CMAKE_CURRENT_SOURCE_DIR}/sendn.c + ${CMAKE_CURRENT_SOURCE_DIR}/shmem.cc + ${CMAKE_CURRENT_SOURCE_DIR}/tcpmem.cc +) + +set(${project}_HEADERS + ${CMAKE_CURRENT_SOURCE_DIR}/locmem.hh + ${CMAKE_CURRENT_SOURCE_DIR}/memsem.hh + ${CMAKE_CURRENT_SOURCE_DIR}/phantom.hh + ${CMAKE_CURRENT_SOURCE_DIR}/physmem.hh + ${CMAKE_CURRENT_SOURCE_DIR}/recvn.h + ${CMAKE_CURRENT_SOURCE_DIR}/rem_msg.hh + ${CMAKE_CURRENT_SOURCE_DIR}/sendn.h + ${CMAKE_CURRENT_SOURCE_DIR}/shmem.hh + ${CMAKE_CURRENT_SOURCE_DIR}/tcpmem.hh +) + +include_directories(../) + +add_library(${project} OBJECT ${${project}_SOURCES} ${${project}_HEADERS} ) +target_compile_options(${project} PUBLIC -fPIC) diff --git a/src/libnml/buffer/locmem.cc b/src/libnml/buffer/locmem.cc index f70030f04..a1af40914 100644 --- a/src/libnml/buffer/locmem.cc +++ b/src/libnml/buffer/locmem.cc @@ -19,9 +19,9 @@ ********************************************************************/ #include "locmem.hh" // class LOCMEM -#include "cms.hh" // class CMS -#include "linklist.hh" // class LinkedList -#include "rcs_print.hh" // rcs_print_error() +#include // class CMS +#include // class LinkedList +#include // rcs_print_error() #ifdef __cplusplus extern "C" { diff --git a/src/libnml/buffer/locmem.hh b/src/libnml/buffer/locmem.hh index 43c83ba1e..1256d66f0 100644 --- a/src/libnml/buffer/locmem.hh +++ b/src/libnml/buffer/locmem.hh @@ -21,8 +21,8 @@ #ifndef LOCMEM_HH #define LOCMEM_HH -#include "cms.hh" // class CMS -#include "linklist.hh" // class LinkedList +#include // class CMS +#include // class LinkedList struct BUFFERS_LIST_NODE { void *addr; diff --git a/src/libnml/buffer/memsem.cc b/src/libnml/buffer/memsem.cc index 953b463e1..7dfdb37d5 100644 --- a/src/libnml/buffer/memsem.cc +++ b/src/libnml/buffer/memsem.cc @@ -34,9 +34,9 @@ extern "C" { }; #endif -#include "timer.hh" /* etime(), esleep() */ +#include /* etime(), esleep() */ #include "memsem.hh" /* struct mem_access_object */ -#include "rcs_print.hh" // rcs_print_error() +#include // rcs_print_error() #define TIMEOUT_MIN ((double) 1.0E-6) diff --git a/src/libnml/buffer/memsem.hh b/src/libnml/buffer/memsem.hh index ed5a701c2..81222057a 100644 --- a/src/libnml/buffer/memsem.hh +++ b/src/libnml/buffer/memsem.hh @@ -17,7 +17,7 @@ #ifndef MEMSEM_HH #define MEMSEM_HH -#include "sem.hh" +#include /* Take the mutual exclusion semaphore. */ struct mem_access_object { diff --git a/src/libnml/buffer/phantom.cc b/src/libnml/buffer/phantom.cc index cf83b5448..f0054af3d 100644 --- a/src/libnml/buffer/phantom.cc +++ b/src/libnml/buffer/phantom.cc @@ -12,7 +12,7 @@ * Last change: ********************************************************************/ -#include "cms.hh" /* enum CMS_STATUS */ +#include /* enum CMS_STATUS */ #include "phantom.hh" /* class PHANTOMMEM */ PHANTOMMEM::PHANTOMMEM(const char *bufline, const char *procline):CMS(bufline, procline) diff --git a/src/libnml/buffer/phantom.hh b/src/libnml/buffer/phantom.hh index 44c628a31..ab5a325c8 100644 --- a/src/libnml/buffer/phantom.hh +++ b/src/libnml/buffer/phantom.hh @@ -15,7 +15,7 @@ #ifndef PHANTOM_HH #define PHANTOM_HH -#include "cms.hh" +#include class PHANTOMMEM:public CMS { public: diff --git a/src/libnml/buffer/physmem.cc b/src/libnml/buffer/physmem.cc index 577af2f4b..89eccc620 100644 --- a/src/libnml/buffer/physmem.cc +++ b/src/libnml/buffer/physmem.cc @@ -26,7 +26,7 @@ extern "C" { } #endif #include "physmem.hh" /* class PHYSMEM_HANDLE */ -#include "rcs_print.hh" +#include PHYSMEM_HANDLE::PHYSMEM_HANDLE() { size = 0; diff --git a/src/libnml/buffer/recvn.c b/src/libnml/buffer/recvn.c index 9435df643..52d0fe4d5 100644 --- a/src/libnml/buffer/recvn.c +++ b/src/libnml/buffer/recvn.c @@ -30,9 +30,9 @@ #include /* struct timeval */ #include /* malloc(), free() */ #include /* strerror() */ -#include "rtapi_math.h" /* modf() */ -#include "rcs_print.hh" /* rcs_print_error() */ -#include "_timer.h" /* etime(), esleep() */ +#include /* modf() */ +#include /* rcs_print_error() */ +#include /* etime(), esleep() */ int recvn_timedout = 0; int print_recvn_timeout_errors = 1; diff --git a/src/libnml/buffer/rem_msg.hh b/src/libnml/buffer/rem_msg.hh index ee0ff5b82..f9a148198 100644 --- a/src/libnml/buffer/rem_msg.hh +++ b/src/libnml/buffer/rem_msg.hh @@ -22,6 +22,7 @@ #ifndef REM_MSG_HH #define REM_MSG_HH +#include // for NULL class CMS_DIAGNOSTICS_INFO; struct CMS_HEADER; diff --git a/src/libnml/buffer/sendn.c b/src/libnml/buffer/sendn.c index 2ac3983f0..550f0bad3 100644 --- a/src/libnml/buffer/sendn.c +++ b/src/libnml/buffer/sendn.c @@ -19,13 +19,13 @@ #include /* strerror */ #include /* memset() */ #include /* errno */ -#include "rtapi_math.h" /* fabs() */ +#include /* fabs() */ #include /* send(), recv(), socket(), accept(), bind(), listen() */ #include /* struct timeval */ #include "sendn.h" /* sendn() */ -#include "rcs_print.hh" /* rcs_print_error() */ -#include "_timer.h" /* etime(), esleep() */ +#include /* rcs_print_error() */ +#include /* etime(), esleep() */ int sendn_timedout = 0; int print_sendn_timeout_errors = 1; diff --git a/src/libnml/buffer/shmem.cc b/src/libnml/buffer/shmem.cc index 93473f57a..8f50bb02b 100644 --- a/src/libnml/buffer/shmem.cc +++ b/src/libnml/buffer/shmem.cc @@ -27,18 +27,18 @@ extern "C" { #include // errno #include /* strchr(), memcpy(), memset() */ #include /* strtod */ -#include /* PHYSMEM_HANDLE */ +#include "physmem.hh" /* PHYSMEM_HANDLE */ #ifdef __cplusplus } #endif -#include "rcs_print.hh" /* rcs_print_error() */ -#include "cms.hh" /* class CMS */ +#include /* rcs_print_error() */ +#include /* class CMS */ #include "shmem.hh" /* class SHMEM */ -#include "shm.hh" /* class RCS_SHAREDMEM */ +#include /* class RCS_SHAREDMEM */ //#include "sem.hh" /* class RCS_SEMAPHORE */ #include "memsem.hh" /* mem_get_access(), mem_release_access() */ -#include "timer.hh" /* etime(), esleep() */ +#include /* etime(), esleep() */ /* Common Definitions. */ //#include "autokey.h" /* rw-rw-r-- permissions */ diff --git a/src/libnml/buffer/shmem.hh b/src/libnml/buffer/shmem.hh index 619a248c3..77c0aeaaf 100644 --- a/src/libnml/buffer/shmem.hh +++ b/src/libnml/buffer/shmem.hh @@ -30,8 +30,8 @@ extern "C" { #ifdef __cplusplus } #endif -#include "cms.hh" /* class CMS */ -#include "shm.hh" /* class RCS_SHAREDMEM */ +#include /* class CMS */ +#include /* class RCS_SHAREDMEM */ #include "memsem.hh" /* struct mem_access_object */ class SHMEM:public CMS { diff --git a/src/libnml/buffer/tcpmem.cc b/src/libnml/buffer/tcpmem.cc index eb185018e..6ac4bba33 100644 --- a/src/libnml/buffer/tcpmem.cc +++ b/src/libnml/buffer/tcpmem.cc @@ -30,21 +30,21 @@ extern "C" { #include #include /* struct timeval */ #include -#include "rtapi_math.h" /* fmod() */ +#include /* fmod() */ #ifdef __cplusplus } #endif -#include "rem_msg.hh" /* REMOTE_CMS_READ_REQUEST_TYPE, etc. */ -#include "rcs_print.hh" /* rcs_print_error() */ -#include "cmsdiag.hh" +#include /* REMOTE_CMS_READ_REQUEST_TYPE, etc. */ +#include /* rcs_print_error() */ +#include #define DEFAULT_MAX_CONSECUTIVE_TIMEOUTS (-1) -#include "timer.hh" /* esleep() */ +#include /* esleep() */ #include "tcpmem.hh" #include "recvn.h" /* recvn() */ #include "sendn.h" /* sendn() */ -#include "tcp_opts.hh" /* SET_TCP_NODELAY */ -#include "linklist.hh" /* LinkedList */ +#include /* SET_TCP_NODELAY */ +#include /* LinkedList */ int tcpmem_sigpipe_count = 0; int last_sig = 0; diff --git a/src/libnml/buffer/tcpmem.hh b/src/libnml/buffer/tcpmem.hh index 469c4ab6b..633586323 100644 --- a/src/libnml/buffer/tcpmem.hh +++ b/src/libnml/buffer/tcpmem.hh @@ -15,8 +15,8 @@ #ifndef TCPMEM_HH #define TCPMEM_HH -#include "cms.hh" /* class CMS */ -#include "rem_msg.hh" // REMOTE_CMS_REQUEST_TYPE +#include /* class CMS */ +#include // REMOTE_CMS_REQUEST_TYPE #ifdef __cplusplus extern "C" { diff --git a/src/libnml/cms/CMakeLists.txt b/src/libnml/cms/CMakeLists.txt new file mode 100644 index 000000000..4ffe892d1 --- /dev/null +++ b/src/libnml/cms/CMakeLists.txt @@ -0,0 +1,37 @@ +cmake_minimum_required(VERSION 2.8) +set (project cms) + +set(${project}_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/cms.cc + ${CMAKE_CURRENT_SOURCE_DIR}/cms_aup.cc + ${CMAKE_CURRENT_SOURCE_DIR}/cms_cfg.cc + ${CMAKE_CURRENT_SOURCE_DIR}/cms_dup.cc + ${CMAKE_CURRENT_SOURCE_DIR}/cms_in.cc + ${CMAKE_CURRENT_SOURCE_DIR}/cms_pm.cc + ${CMAKE_CURRENT_SOURCE_DIR}/cms_srv.cc + ${CMAKE_CURRENT_SOURCE_DIR}/cms_up.cc + ${CMAKE_CURRENT_SOURCE_DIR}/cms_xup.cc + ${CMAKE_CURRENT_SOURCE_DIR}/cmsdiag.cc + ${CMAKE_CURRENT_SOURCE_DIR}/cmssvrp.cc + ${CMAKE_CURRENT_SOURCE_DIR}/tcp_opts.cc + ${CMAKE_CURRENT_SOURCE_DIR}/tcp_srv.cc +) + +set(${project}_HEADERS + ${CMAKE_CURRENT_SOURCE_DIR}/cms.hh + ${CMAKE_CURRENT_SOURCE_DIR}/cms_aup.hh + ${CMAKE_CURRENT_SOURCE_DIR}/cms_cfg.hh + ${CMAKE_CURRENT_SOURCE_DIR}/cms_dup.hh + ${CMAKE_CURRENT_SOURCE_DIR}/cms_srv.hh + ${CMAKE_CURRENT_SOURCE_DIR}/cms_up.hh + ${CMAKE_CURRENT_SOURCE_DIR}/cms_user.hh + ${CMAKE_CURRENT_SOURCE_DIR}/cms_xup.hh + ${CMAKE_CURRENT_SOURCE_DIR}/cmsdiag.hh + ${CMAKE_CURRENT_SOURCE_DIR}/tcp_opts.hh + ${CMAKE_CURRENT_SOURCE_DIR}/tcp_srv.hh +) + +include_directories(../) + +add_library(${project} OBJECT ${${project}_SOURCES} ${${project}_HEADERS} ) +target_compile_options(${project} PUBLIC -fPIC) diff --git a/src/libnml/cms/cms.cc b/src/libnml/cms/cms.cc index 1b7c0175b..0e082f069 100644 --- a/src/libnml/cms/cms.cc +++ b/src/libnml/cms/cms.cc @@ -16,7 +16,7 @@ * Last change: ********************************************************************/ -#include "rcsversion.h" +#include #ifdef __cplusplus extern "C" { @@ -37,11 +37,11 @@ extern "C" { #include "cms_xup.hh" /* class CMS_XDR_UPDATER */ #include "cms_aup.hh" /* class CMS_ASCII_UPDATER */ #include "cms_dup.hh" /* class CMS_DISPLAY_ASCII_UPDATER */ -#include "rcs_print.hh" /* rcs_print_error(), separate_words() */ +#include /* rcs_print_error(), separate_words() */ /* rcs_print_debug() */ #include "cmsdiag.hh" -#include "linklist.hh" /* LinkedList */ -#include "physmem.hh" +#include /* LinkedList */ +#include int instance_no = 0; diff --git a/src/libnml/cms/cms_aup.cc b/src/libnml/cms/cms_aup.cc index c75c619bb..6a1edbc5d 100644 --- a/src/libnml/cms/cms_aup.cc +++ b/src/libnml/cms/cms_aup.cc @@ -37,7 +37,7 @@ extern "C" { #endif #include "cms.hh" /* class CMS */ #include "cms_aup.hh" /* class CMS_ASCII_UPDATER */ -#include "rcs_print.hh" /* rcs_print_error() */ +#include /* rcs_print_error() */ #define DEFAULT_WARNING_COUNT_MAX 100 /* Member functions for CMS_ASCII_UPDATER Class */ diff --git a/src/libnml/cms/cms_cfg.cc b/src/libnml/cms/cms_cfg.cc index 1ef2c3aa3..ff0bdafb1 100644 --- a/src/libnml/cms/cms_cfg.cc +++ b/src/libnml/cms/cms_cfg.cc @@ -40,12 +40,12 @@ extern "C" { method for remote connection, for most applications. It is more reliable and can handle larger messages than UDP and is more widely available than RPC. */ -#include "tcpmem.hh" /* class TCPMEM */ +#include /* class TCPMEM */ /* If the buffer type or process type specified in the configuration file is "PHANTOM" then every NML call of that type will result in calling your phantom function. */ -#include "phantom.hh" /* class PHANTOMMEM */ +#include /* class PHANTOMMEM */ /* LOCMEM is useful when many modules are linked together in one thread of execution but you want to write them such that each module uses the NML @@ -53,7 +53,7 @@ extern "C" { running separately. There is no need for any mutual exclusion mechanism and memory is obtained with a simple malloc so the operating system will not exceed its limits for semaphores or shared memory segments. */ -#include "locmem.hh" /* class LOCMEM */ +#include /* class LOCMEM */ /* SHMEM is intended for communications between tasks managed by the same operating system. The operating system allocates the memory to be shared @@ -61,10 +61,10 @@ extern "C" { exclusion techniques, using an operating system semaphore or mutex, or disabling and enabling context switching or interrupts during the appropriate critical sections. */ -#include "shmem.hh" /* class SHMEM */ +#include /* class SHMEM */ -#include "rcs_print.hh" /* rcs_print_error() */ -#include "linklist.hh" /* LinkedList */ +#include /* rcs_print_error() */ +#include /* LinkedList */ struct CONFIG_FILE_INFO { CONFIG_FILE_INFO() { diff --git a/src/libnml/cms/cms_dup.cc b/src/libnml/cms/cms_dup.cc index 9fdfb8daf..23eb3b3d2 100644 --- a/src/libnml/cms/cms_dup.cc +++ b/src/libnml/cms/cms_dup.cc @@ -32,7 +32,7 @@ extern "C" { #endif #include "cms.hh" /* class CMS */ #include "cms_dup.hh" /* class CMS_DISPLAY_ASCII_UPDATER */ -#include "rcs_print.hh" /* rcs_print_error() */ +#include /* rcs_print_error() */ #define DEFAULT_WARNING_COUNT_MAX 100 /* Member functions for CMS_DISPLAY_ASCII_UPDATER Class */ CMS_DISPLAY_ASCII_UPDATER::CMS_DISPLAY_ASCII_UPDATER(CMS * _cms_parent): diff --git a/src/libnml/cms/cms_in.cc b/src/libnml/cms/cms_in.cc index 77b822b38..41e2ce030 100644 --- a/src/libnml/cms/cms_in.cc +++ b/src/libnml/cms/cms_in.cc @@ -34,8 +34,8 @@ #include "cms.hh" /* class CMS */ #include "cmsdiag.hh" // class CMS_DIAG_PROC_INFO, CMS_DIAG_HEADER -#include "rcs_print.hh" /* rcs_print_error() */ -#include "physmem.hh" /* class PHYSMEM_HANDLE */ +#include /* rcs_print_error() */ +#include /* class PHYSMEM_HANDLE */ /* CMS Member Functions. */ diff --git a/src/libnml/cms/cms_pm.cc b/src/libnml/cms/cms_pm.cc index 0ae034320..46cf9078c 100644 --- a/src/libnml/cms/cms_pm.cc +++ b/src/libnml/cms/cms_pm.cc @@ -14,7 +14,7 @@ ********************************************************************/ #include "cms.hh" // class CMS -#include "posemath.h" // POSEMATH classes +#include // POSEMATH classes // translation types CMS_STATUS CMS::update(PM_CARTESIAN & Cart) { diff --git a/src/libnml/cms/cms_srv.cc b/src/libnml/cms/cms_srv.cc index 6c3cb2d98..0fef0ff60 100644 --- a/src/libnml/cms/cms_srv.cc +++ b/src/libnml/cms/cms_srv.cc @@ -21,7 +21,7 @@ extern "C" { #include /* strchr(), memcpy() */ #include /* malloc(), free(), exit() */ #include // isgraph() -#include "rtapi_math.h" /* fmod() */ +#include /* fmod() */ #include #include /* getpid() */ @@ -32,16 +32,16 @@ extern "C" { } #endif #include "cms.hh" /* class CMS */ -#include "rem_msg.hh" /* struct REMOTE_READ_REQUEST, */ +#include /* struct REMOTE_READ_REQUEST, */ /* struct REMOTE_WRITE_REQUEST, */ #include "cms_srv.hh" /* class CMS_SERVER */ #include "cms_cfg.hh" /* cms_config() */ -#include "rcs_print.hh" /* rcs_print_error() */ +#include /* rcs_print_error() */ #ifndef NO_DCE_RPC #define NO_DCE_RPC #endif #include "tcp_srv.hh" /* CMS_SERVER_TCP_PORT */ -#include "timer.hh" // etime() +#include // etime() #include "cmsdiag.hh" int cms_server_count = 0; diff --git a/src/libnml/cms/cms_srv.hh b/src/libnml/cms/cms_srv.hh index 8383e3bd9..e2157141c 100644 --- a/src/libnml/cms/cms_srv.hh +++ b/src/libnml/cms/cms_srv.hh @@ -27,12 +27,13 @@ #include "cms_user.hh" /* class CMS, CMS_STATUS */ #include "cms_cfg.hh" /* CMS_CONFIG_LINELEN */ -#include "rem_msg.hh" /* struct REMOTE_READ_REQUEST, */ +#include /* struct REMOTE_READ_REQUEST, */ /* struct REMOTE_WRITE_REQUEST, */ +#include extern int cms_server_count; extern void wait_for_servers(int); -class LinkedList; +//class LinkedList; extern LinkedList *cms_server_list; class CMS_SERVER; diff --git a/src/libnml/cms/cms_up.cc b/src/libnml/cms/cms_up.cc index fee13788f..5627862b5 100644 --- a/src/libnml/cms/cms_up.cc +++ b/src/libnml/cms/cms_up.cc @@ -16,7 +16,7 @@ #include "cms.hh" /* class CMS */ #include "cms_up.hh" /* class CMS_UPDATER */ -#include "rcs_print.hh" /* rcs_print_error() */ +#include /* rcs_print_error() */ #ifdef __cplusplus extern "C" { diff --git a/src/libnml/cms/cms_xup.cc b/src/libnml/cms/cms_xup.cc index 4d6001f6c..7e75b2313 100644 --- a/src/libnml/cms/cms_xup.cc +++ b/src/libnml/cms/cms_xup.cc @@ -21,7 +21,7 @@ extern "C" { #include "cms.hh" /* class CMS */ #include "cms_xup.hh" /* class CMS_XDR_UPDATER */ -#include "rcs_print.hh" /* rcs_print_error() */ +#include /* rcs_print_error() */ /* Member functions for CMS_XDR_UPDATER Class */ CMS_XDR_UPDATER::CMS_XDR_UPDATER(CMS * _cms_parent):CMS_UPDATER(_cms_parent, diff --git a/src/libnml/cms/cmsdiag.cc b/src/libnml/cms/cmsdiag.cc index 2ef019b4c..36db0dee6 100644 --- a/src/libnml/cms/cmsdiag.cc +++ b/src/libnml/cms/cmsdiag.cc @@ -13,16 +13,16 @@ ********************************************************************/ #include "cmsdiag.hh" -#include "rcsversion.h" +#include #include #include /* getpid() */ -#include "timer.hh" // etime() +#include // etime() #include // memset() #include // strncpy() #include // time_t, time() -#include "rtapi_math.h" // floor() -#include "linklist.hh" // LinkedList -#include "physmem.hh" // PHYSMEM_HANDLE +#include // floor() +#include // LinkedList +#include // PHYSMEM_HANDLE CMS_DIAGNOSTICS_INFO::CMS_DIAGNOSTICS_INFO() { diff --git a/src/libnml/cms/cmssvrp.cc b/src/libnml/cms/cmssvrp.cc index 7a521176c..311dbb68d 100644 --- a/src/libnml/cms/cmssvrp.cc +++ b/src/libnml/cms/cmssvrp.cc @@ -12,6 +12,9 @@ * Last change: ********************************************************************/ +#include "cms_srv.hh" // for CMS_SERVER +#include + extern "C" void cms_print_servers(); void cms_print_servers() diff --git a/src/libnml/cms/tcp_opts.cc b/src/libnml/cms/tcp_opts.cc index 9486703e8..28117ee08 100644 --- a/src/libnml/cms/tcp_opts.cc +++ b/src/libnml/cms/tcp_opts.cc @@ -13,7 +13,7 @@ ********************************************************************/ #include "tcp_opts.hh" -#include "rcs_print.hh" /* rcs_print_error() */ +#include /* rcs_print_error() */ #include // errno #include // strerror diff --git a/src/libnml/cms/tcp_srv.cc b/src/libnml/cms/tcp_srv.cc index eaa237e9f..b3a2714f4 100644 --- a/src/libnml/cms/tcp_srv.cc +++ b/src/libnml/cms/tcp_srv.cc @@ -43,19 +43,19 @@ extern "C" { #include /* inet_ntoa */ #include "cms.hh" /* class CMS */ -#include "nml.hh" // class NML +#include // class NML #include "tcp_srv.hh" /* class CMS_SERVER_REMOTE_TCP_PORT */ -#include "rcs_print.hh" /* rcs_print_error() */ -#include "linklist.hh" /* class LinkedList */ +#include /* rcs_print_error() */ +#include /* class LinkedList */ #include "tcp_opts.hh" /* SET_TCP_NODELAY */ -#include "timer.hh" // esleep() -#include "_timer.h" +#include // esleep() +#include #include "cmsdiag.hh" // class CMS_DIAGNOSTICS_INFO extern "C" { -#include "recvn.h" /* recvn() */ -#include "sendn.h" /* sendn() */ +#include /* recvn() */ +#include /* sendn() */ } -#include "physmem.hh" // PHYSMEM_HANDLE +#include // PHYSMEM_HANDLE int tcpsvr_threads_created = 0; int tcpsvr_threads_killed = 0; diff --git a/src/libnml/cms/tcp_srv.hh b/src/libnml/cms/tcp_srv.hh index 39df107e0..fd909fdc1 100644 --- a/src/libnml/cms/tcp_srv.hh +++ b/src/libnml/cms/tcp_srv.hh @@ -16,8 +16,8 @@ #define TCP_SRV_HH #include "cms_srv.hh" /* class CMS_SERVER_REMOTE_PORT */ -#include "linklist.hh" /* class LinkedList */ -#include "rem_msg.hh" +#include /* class LinkedList */ +#include #ifdef __cplusplus extern "C" { diff --git a/src/libnml/linklist/CMakeLists.txt b/src/libnml/linklist/CMakeLists.txt new file mode 100644 index 000000000..4462f57f1 --- /dev/null +++ b/src/libnml/linklist/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 2.8) +set (project linklist) + +set(${project}_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/linklist.cc +) + +set(${project}_HEADERS + ${CMAKE_CURRENT_SOURCE_DIR}/linklist.hh +) + +add_library(${project} OBJECT ${${project}_SOURCES} ${${project}_HEADERS} ) +target_compile_options(${project} PUBLIC -fPIC) diff --git a/src/libnml/nml/CMakeLists.txt b/src/libnml/nml/CMakeLists.txt new file mode 100644 index 000000000..dc5f676e6 --- /dev/null +++ b/src/libnml/nml/CMakeLists.txt @@ -0,0 +1,33 @@ +cmake_minimum_required(VERSION 2.8) +set (project nml_objs) + +set(${project}_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/cmd_msg.cc + ${CMAKE_CURRENT_SOURCE_DIR}/nml.cc + ${CMAKE_CURRENT_SOURCE_DIR}/nml_mod.cc + ${CMAKE_CURRENT_SOURCE_DIR}/nml_oi.cc + ${CMAKE_CURRENT_SOURCE_DIR}/nml_srv.cc + ${CMAKE_CURRENT_SOURCE_DIR}/nmldiag.cc + ${CMAKE_CURRENT_SOURCE_DIR}/nmlmsg.cc + ${CMAKE_CURRENT_SOURCE_DIR}/stat_msg.cc +) + +# Header not used / residual? +#check_include_file(machinekit/inifile.hh MACHINEKIT_HAL_INI_FOUND) + +set(${project}_HEADERS + ${CMAKE_CURRENT_SOURCE_DIR}/cmd_msg.hh + ${CMAKE_CURRENT_SOURCE_DIR}/nml.hh + ${CMAKE_CURRENT_SOURCE_DIR}/nml_mod.hh + ${CMAKE_CURRENT_SOURCE_DIR}/nml_oi.hh + ${CMAKE_CURRENT_SOURCE_DIR}/nml_srv.hh + ${CMAKE_CURRENT_SOURCE_DIR}/nml_type.hh + ${CMAKE_CURRENT_SOURCE_DIR}/nmldiag.hh + ${CMAKE_CURRENT_SOURCE_DIR}/nmlmsg.hh + ${CMAKE_CURRENT_SOURCE_DIR}/stat_msg.hh +) + +include_directories(../) + +add_library(${project} OBJECT ${${project}_SOURCES} ${${project}_HEADERS} ) +target_compile_options(${project} PUBLIC -fPIC) diff --git a/src/libnml/nml/cmd_msg.cc b/src/libnml/nml/cmd_msg.cc index 518510f94..234b6ab90 100644 --- a/src/libnml/nml/cmd_msg.cc +++ b/src/libnml/nml/cmd_msg.cc @@ -21,11 +21,11 @@ extern "C" { #endif #include "nml.hh" #include "nmlmsg.hh" -#include "cms.hh" +#include NMLTYPE nmltype; #include "cmd_msg.hh" -#include "linklist.hh" +#include RCS_CMD_MSG::RCS_CMD_MSG(NMLTYPE t, long sz):NMLmsg(t, sz) { diff --git a/src/libnml/nml/nml.cc b/src/libnml/nml/nml.cc index 808672056..f22f31558 100644 --- a/src/libnml/nml/nml.cc +++ b/src/libnml/nml/nml.cc @@ -13,7 +13,7 @@ * Last change: ********************************************************************/ -#include "rcsversion.h" +#include #ifdef __cplusplus extern "C" { @@ -30,13 +30,13 @@ extern "C" { #endif #include "nml.hh" /* class NML */ #include "nmlmsg.hh" /* class NMLmsg */ -#include "cms.hh" /* class CMS */ -#include "timer.hh" // esleep() +#include /* class CMS */ +#include // esleep() #include "nml_srv.hh" /* NML_Default_Super_Server */ -#include "cms_cfg.hh" /* cms_config(), cms_copy() */ -#include "linklist.hh" /* class LinkedList */ -#include "rcs_print.hh" /* rcs_print_error() */ -#include "physmem.hh" +#include /* cms_config(), cms_copy() */ +#include /* class LinkedList */ +#include /* rcs_print_error() */ +#include #ifndef MAXHOSTNAMELEN #define MAXHOSTNAMELEN 64 #endif diff --git a/src/libnml/nml/nml.hh b/src/libnml/nml/nml.hh index c38a5d7ae..468130439 100644 --- a/src/libnml/nml/nml.hh +++ b/src/libnml/nml/nml.hh @@ -25,7 +25,7 @@ extern "C" { #ifdef __cplusplus } #endif -#include "cms_user.hh" /* class CMS_USER */ +#include /* class CMS_USER */ class LinkedList; /* Generic NML Stuff */ #include "nml_type.hh" diff --git a/src/libnml/nml/nml_mod.cc b/src/libnml/nml/nml_mod.cc index 3bba6d469..9314e1bc3 100644 --- a/src/libnml/nml/nml_mod.cc +++ b/src/libnml/nml/nml_mod.cc @@ -54,7 +54,7 @@ extern "C" #include // strcpy() #include // errno #include -#include "rtapi_math.h" // fabs() +#include // fabs() #ifdef __cplusplus } @@ -63,8 +63,8 @@ extern "C" #include "nml_mod.hh" #include "nml_oi.hh" // NML_ERROR, NML_TEXT, NML_DISPLAY -#include "rcs_print.hh" -#include "rcs_exit.hh" +#include +#include NML_MODULE::NML_MODULE (const char *inifile, const char *section) diff --git a/src/libnml/nml/nml_mod.hh b/src/libnml/nml/nml_mod.hh index f492d7591..fd94c37db 100644 --- a/src/libnml/nml/nml_mod.hh +++ b/src/libnml/nml/nml_mod.hh @@ -53,12 +53,12 @@ 5-Apr-1996 Fred Proctor created */ -#include "rcs.hh" +#include #include "nml.hh" // NML, NMLmsg #include "stat_msg.hh" // RCS_STAT_CHANNEL, RCS_STAT_MSG #include "cmd_msg.hh" // RCS_CMD_CHANNEL, RCS_CMD_MSG -#include "timer.hh" // RCS_TIMER -#include "inifile.hh" // class INIFILE +#include // RCS_TIMER +#include // class INIFILE diff --git a/src/libnml/nml/nml_oi.hh b/src/libnml/nml/nml_oi.hh index 2f3ec4be5..ded8ee681 100644 --- a/src/libnml/nml/nml_oi.hh +++ b/src/libnml/nml/nml_oi.hh @@ -17,7 +17,7 @@ #ifndef NML_OI_HH #define NML_OI_HH -#include "cms.hh" // class CMS +#include // class CMS #include "nml.hh" // class NML #include "nmlmsg.hh" // class NMLmsg diff --git a/src/libnml/nml/nml_srv.cc b/src/libnml/nml/nml_srv.cc index 8c5366058..1445e62e0 100644 --- a/src/libnml/nml/nml_srv.cc +++ b/src/libnml/nml/nml_srv.cc @@ -29,15 +29,15 @@ extern "C" { #endif #include "nml.hh" #include "nmlmsg.hh" -#include "cms.hh" +#include #include "nml_srv.hh" -#include "rem_msg.hh" /* struct REMOTE_READ_REQUEST, */ -#include "rcs_print.hh" /* rcs_print_error() */ -#include "timer.hh" // esleep() -#include "rcs_exit.hh" // rcs_exit -#include "linklist.hh" -#include "physmem.hh" -#include "cmsdiag.hh" +#include /* struct REMOTE_READ_REQUEST, */ +#include /* rcs_print_error() */ +#include // esleep() +#include // rcs_exit +#include +#include +#include NML_SERVER::NML_SERVER(NML * _nml, int _set_to_master):CMS_SERVER() { NML_SERVER_LOCAL_PORT *new_local_port = NULL; diff --git a/src/libnml/nml/nml_srv.hh b/src/libnml/nml/nml_srv.hh index ddadfbd7d..dde332b25 100644 --- a/src/libnml/nml/nml_srv.hh +++ b/src/libnml/nml/nml_srv.hh @@ -25,9 +25,9 @@ extern "C" { #ifdef __cplusplus } #endif -#include "cms_srv.hh" /* class CMS_SERVER */ +#include /* class CMS_SERVER */ #include "nml.hh" /* class NML */ -#include "rem_msg.hh" /* struct REMOTE_READ_REQUEST, */ +#include /* struct REMOTE_READ_REQUEST, */ class NML_SERVER_LOCAL_PORT:public CMS_SERVER_LOCAL_PORT { protected: NML * nml; diff --git a/src/libnml/nml/nmldiag.cc b/src/libnml/nml/nmldiag.cc index 49c9e87cb..e7ad350d0 100644 --- a/src/libnml/nml/nmldiag.cc +++ b/src/libnml/nml/nmldiag.cc @@ -14,8 +14,8 @@ #include "nml.hh" // NML_MAIN_Channel_List #include "nmldiag.hh" -#include "rcs_print.hh" -#include "linklist.hh" +#include +#include #include static char access_name[9][40] = { diff --git a/src/libnml/nml/nmldiag.hh b/src/libnml/nml/nmldiag.hh index 0fcb457cc..a43a07c36 100644 --- a/src/libnml/nml/nmldiag.hh +++ b/src/libnml/nml/nmldiag.hh @@ -15,7 +15,7 @@ #ifndef NMLDIAG_HH #define NMLDIAG_HH -#include "cmsdiag.hh" +#include class NML_DIAGNOSTICS_INFO:public CMS_DIAGNOSTICS_INFO { public: diff --git a/src/libnml/nml/nmlmsg.cc b/src/libnml/nml/nmlmsg.cc index d3267f713..43c9b7590 100644 --- a/src/libnml/nml/nmlmsg.cc +++ b/src/libnml/nml/nmlmsg.cc @@ -20,9 +20,9 @@ extern "C" { #ifdef __cplusplus } #endif -#include "cms.hh" +#include #include "nmlmsg.hh" -#include "rcs_print.hh" /* rcs_error_print() */ +#include /* rcs_error_print() */ /* NMLmsg Functions. */ int NMLmsg::automatically_clear = 1; /* Constructor */ diff --git a/src/libnml/nml/stat_msg.cc b/src/libnml/nml/stat_msg.cc index 6a1ababe1..5e6ac9bde 100644 --- a/src/libnml/nml/stat_msg.cc +++ b/src/libnml/nml/stat_msg.cc @@ -14,9 +14,9 @@ #include "nml.hh" #include "nmlmsg.hh" -#include "cms.hh" -#include "physmem.hh" -#include "linklist.hh" +#include +#include +#include #include "stat_msg.hh" diff --git a/src/libnml/os_intf/CMakeLists.txt b/src/libnml/os_intf/CMakeLists.txt new file mode 100644 index 000000000..760908be7 --- /dev/null +++ b/src/libnml/os_intf/CMakeLists.txt @@ -0,0 +1,27 @@ +cmake_minimum_required(VERSION 2.8) +set (project os_intf) + +set(${project}_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/inetnull.cc + ${CMAKE_CURRENT_SOURCE_DIR}/_sem.c + ${CMAKE_CURRENT_SOURCE_DIR}/sem.cc + ${CMAKE_CURRENT_SOURCE_DIR}/_shm.c + ${CMAKE_CURRENT_SOURCE_DIR}/shm.cc + ${CMAKE_CURRENT_SOURCE_DIR}/_timer.c + ${CMAKE_CURRENT_SOURCE_DIR}/timer.cc +) + +set(${project}_HEADERS + ${CMAKE_CURRENT_SOURCE_DIR}/inetfile.hh + ${CMAKE_CURRENT_SOURCE_DIR}/_sem.h + ${CMAKE_CURRENT_SOURCE_DIR}/sem.hh + ${CMAKE_CURRENT_SOURCE_DIR}/_shm.h + ${CMAKE_CURRENT_SOURCE_DIR}/shm.hh + ${CMAKE_CURRENT_SOURCE_DIR}/_timer.h + ${CMAKE_CURRENT_SOURCE_DIR}/timer.hh +) + +include_directories(../) + +add_library(${project} OBJECT ${${project}_SOURCES} ${${project}_HEADERS} ) +target_compile_options(${project} PUBLIC -fPIC) diff --git a/src/libnml/os_intf/_sem.c b/src/libnml/os_intf/_sem.c index 37ed9eed9..65943aefa 100644 --- a/src/libnml/os_intf/_sem.c +++ b/src/libnml/os_intf/_sem.c @@ -42,7 +42,7 @@ typedef int rcs_sem_t; #include "_sem.h" #include "_timer.h" /* etime() */ -#include "rcs_print.hh" +#include #define SEM_TAKE (-1) /* decrement sembuf.sem_op */ #define SEM_GIVE (1) /* increment sembuf.sem_op */ diff --git a/src/libnml/os_intf/_shm.c b/src/libnml/os_intf/_shm.c index 63465bd53..46bb49b96 100644 --- a/src/libnml/os_intf/_shm.c +++ b/src/libnml/os_intf/_shm.c @@ -15,7 +15,7 @@ extern int instance_no; // exported from cms.cc #include "_shm.h" -#include "rcs_print.hh" +#include #include /* NULL */ #include #include diff --git a/src/libnml/os_intf/_timer.c b/src/libnml/os_intf/_timer.c index 62777bf8e..5ef55f26c 100644 --- a/src/libnml/os_intf/_timer.c +++ b/src/libnml/os_intf/_timer.c @@ -15,7 +15,7 @@ * Last change: ********************************************************************/ -#include "rcs_print.hh" /* rcs_print_error */ +#include /* rcs_print_error */ #include /* NULL */ #include /* errno */ diff --git a/src/libnml/os_intf/rtapi_byteorder.h b/src/libnml/os_intf/rtapi_byteorder.h deleted file mode 120000 index b0c151b4f..000000000 --- a/src/libnml/os_intf/rtapi_byteorder.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_byteorder.h \ No newline at end of file diff --git a/src/libnml/os_intf/rtapi_errno.h b/src/libnml/os_intf/rtapi_errno.h deleted file mode 120000 index a7c499fbe..000000000 --- a/src/libnml/os_intf/rtapi_errno.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_errno.h \ No newline at end of file diff --git a/src/libnml/os_intf/rtapi_math.h b/src/libnml/os_intf/rtapi_math.h deleted file mode 120000 index cdb837d6c..000000000 --- a/src/libnml/os_intf/rtapi_math.h +++ /dev/null @@ -1 +0,0 @@ -../../../fakeinclude/rtapi_math.h \ No newline at end of file diff --git a/src/libnml/os_intf/sem.cc b/src/libnml/os_intf/sem.cc index 98cd2a96e..559cce4d9 100644 --- a/src/libnml/os_intf/sem.cc +++ b/src/libnml/os_intf/sem.cc @@ -17,7 +17,7 @@ extern "C" { #include "_sem.h" } #include "sem.hh" -#include "rcs_print.hh" // rcs_print_debug(), +#include // rcs_print_debug(), // PRINT_SEMAPHORE_ACTIVITY #include "timer.hh" // etime() RCS_SEMAPHORE::RCS_SEMAPHORE(key_t _id, int _oflag, double _time, diff --git a/src/libnml/os_intf/shm.cc b/src/libnml/os_intf/shm.cc index 9da4ce3d9..eca7d1a62 100644 --- a/src/libnml/os_intf/shm.cc +++ b/src/libnml/os_intf/shm.cc @@ -14,7 +14,7 @@ #include "shm.hh" #include "_shm.h" /* rcs_shm_open(), rcs_shm_close() */ -#include "rcs_print.hh" // rcs_print_error() +#include // rcs_print_error() extern "C" { #include /* fprintf(), stderr */ diff --git a/src/libnml/rcs/CMakeLists.txt b/src/libnml/rcs/CMakeLists.txt new file mode 100644 index 000000000..2bc92cbd3 --- /dev/null +++ b/src/libnml/rcs/CMakeLists.txt @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 2.8) +set (project rcs) + +set(${project}_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/rcs_exit.cc + ${CMAKE_CURRENT_SOURCE_DIR}/rcs_print.cc +) + +set(${project}_HEADERS + ${CMAKE_CURRENT_SOURCE_DIR}/rcs_exit.hh + ${CMAKE_CURRENT_SOURCE_DIR}/rcs.hh + ${CMAKE_CURRENT_SOURCE_DIR}/rcs_print.hh + ${CMAKE_CURRENT_SOURCE_DIR}/rcsversion.h +) + +include_directories(../) + +add_library(${project} OBJECT ${${project}_SOURCES} ${${project}_HEADERS} ) +target_compile_options(${project} PUBLIC -fPIC) + diff --git a/src/libnml/rcs/rcs.hh b/src/libnml/rcs/rcs.hh index 1779f8885..1cfd1a173 100644 --- a/src/libnml/rcs/rcs.hh +++ b/src/libnml/rcs/rcs.hh @@ -35,5 +35,5 @@ enum RCS_STATUS { /* Originally from nml_mod.hh */ RCS_ERROR = 3 }; -#include "nml_type.hh" +#include #endif /* !defined(RCS_HH) */ diff --git a/src/libnml/rcs/rcs_exit.cc b/src/libnml/rcs/rcs_exit.cc index 96f61359e..869b8abc4 100644 --- a/src/libnml/rcs/rcs_exit.cc +++ b/src/libnml/rcs/rcs_exit.cc @@ -18,9 +18,9 @@ /* Forward Function Prototypes */ #include "rcs_exit.hh" -#include "linklist.hh" // LinkedList +#include // LinkedList #include "rcs_print.hh" // rcs_print_error() -#include "timer.hh" // esleep() +#include // esleep() #ifdef __cplusplus extern "C" { diff --git a/src/libnml/rcs/rcs_print.cc b/src/libnml/rcs/rcs_print.cc index b95421ee0..c114aacf9 100644 --- a/src/libnml/rcs/rcs_print.cc +++ b/src/libnml/rcs/rcs_print.cc @@ -29,7 +29,7 @@ extern "C" { } #endif #include "rcs_print.hh" -#include "linklist.hh" +#include #ifndef _TIMER_H extern "C" double etime(void); #endif diff --git a/src/machinetalk/CMakeLists.txt b/src/machinetalk/CMakeLists.txt new file mode 100644 index 000000000..a3ce48a5c --- /dev/null +++ b/src/machinetalk/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(protobuf) diff --git a/src/machinetalk/protobuf/CMakeLists.txt b/src/machinetalk/protobuf/CMakeLists.txt new file mode 100644 index 000000000..988ee7229 --- /dev/null +++ b/src/machinetalk/protobuf/CMakeLists.txt @@ -0,0 +1,44 @@ +cmake_minimum_required(VERSION 2.8) +set (project protobuf) + +set(${project}_HEADERS + ${CMAKE_CURRENT_SOURCE_DIR}/canon.npb.h + ${CMAKE_CURRENT_SOURCE_DIR}/canon.pb.h + ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt + ${CMAKE_CURRENT_SOURCE_DIR}/config.npb.h + ${CMAKE_CURRENT_SOURCE_DIR}/config.pb.h + ${CMAKE_CURRENT_SOURCE_DIR}/emcclass.npb.h + ${CMAKE_CURRENT_SOURCE_DIR}/emcclass.pb.h + ${CMAKE_CURRENT_SOURCE_DIR}/firmware.npb.h + ${CMAKE_CURRENT_SOURCE_DIR}/firmware.pb.h + ${CMAKE_CURRENT_SOURCE_DIR}/jplan.npb.h + ${CMAKE_CURRENT_SOURCE_DIR}/jplan.pb.h + ${CMAKE_CURRENT_SOURCE_DIR}/log.npb.h + ${CMAKE_CURRENT_SOURCE_DIR}/log.pb.h + ${CMAKE_CURRENT_SOURCE_DIR}/message.npb.h + ${CMAKE_CURRENT_SOURCE_DIR}/message.pb.h + ${CMAKE_CURRENT_SOURCE_DIR}/motcmds.npb.h + ${CMAKE_CURRENT_SOURCE_DIR}/motcmds.pb.h + ${CMAKE_CURRENT_SOURCE_DIR}/nanopb.npb.h + ${CMAKE_CURRENT_SOURCE_DIR}/nanopb.pb.h + ${CMAKE_CURRENT_SOURCE_DIR}/object.npb.h + ${CMAKE_CURRENT_SOURCE_DIR}/object.pb.h + ${CMAKE_CURRENT_SOURCE_DIR}/preview.npb.h + ${CMAKE_CURRENT_SOURCE_DIR}/preview.pb.h + ${CMAKE_CURRENT_SOURCE_DIR}/ros.npb.h + ${CMAKE_CURRENT_SOURCE_DIR}/ros.pb.h + ${CMAKE_CURRENT_SOURCE_DIR}/rtapicommand.npb.h + ${CMAKE_CURRENT_SOURCE_DIR}/rtapicommand.pb.h + ${CMAKE_CURRENT_SOURCE_DIR}/rtapi_message.npb.h + ${CMAKE_CURRENT_SOURCE_DIR}/rtapi_message.pb.h + ${CMAKE_CURRENT_SOURCE_DIR}/status.npb.h + ${CMAKE_CURRENT_SOURCE_DIR}/status.pb.h + ${CMAKE_CURRENT_SOURCE_DIR}/task.npb.h + ${CMAKE_CURRENT_SOURCE_DIR}/task.pb.h + ${CMAKE_CURRENT_SOURCE_DIR}/test.npb.h + ${CMAKE_CURRENT_SOURCE_DIR}/test.pb.h + ${CMAKE_CURRENT_SOURCE_DIR}/types.npb.h + ${CMAKE_CURRENT_SOURCE_DIR}/types.pb.h + ${CMAKE_CURRENT_SOURCE_DIR}/value.npb.h + ${CMAKE_CURRENT_SOURCE_DIR}/value.pb.h +) diff --git a/src/module_helper/CMakeLists.txt b/src/module_helper/CMakeLists.txt new file mode 100644 index 000000000..5c0f8688a --- /dev/null +++ b/src/module_helper/CMakeLists.txt @@ -0,0 +1,8 @@ +set (project mk_module_helper) + +add_executable(${project} module_helper.c) +target_link_libraries(${project} mkulapi) + +install(TARGETS ${project} + RUNTIME DESTINATION libexec +) diff --git a/src/module_helper/module_helper.c b/src/module_helper/module_helper.c index c67571c4e..9247a4c20 100644 --- a/src/module_helper/module_helper.c +++ b/src/module_helper/module_helper.c @@ -36,8 +36,8 @@ think of a better way. #include #include // PATH_MAX -#include "rtapi.h" -#include "rtapi_compat.h" +#include +#include void error(int argc, char **argv) { int i; diff --git a/src/po/CMakeLists.txt b/src/po/CMakeLists.txt new file mode 100644 index 000000000..3fe2797ef --- /dev/null +++ b/src/po/CMakeLists.txt @@ -0,0 +1,6 @@ + +file(GLOB MK_LOCALE_FILES "po/*.po") +gettext_create_translations(mk.mo ALL ${MK_LOCALE_FILES}) + +file(GLOB GMOCCAPY_LOCALE_FILES "po/gmoccapy/*.po") +gettext_create_translations(gmoccapy.mo ALL ${GMOCCAPY_LOCALE_FILES})