16.01.2011 - new modules - pimath and pigeometry
This commit is contained in:
460
Makefile
Normal file
460
Makefile
Normal file
@@ -0,0 +1,460 @@
|
|||||||
|
# CMAKE generated file: DO NOT EDIT!
|
||||||
|
# Generated by "Unix Makefiles" Generator, CMake Version 2.8
|
||||||
|
|
||||||
|
# Default target executed when no arguments are given to make.
|
||||||
|
default_target: all
|
||||||
|
.PHONY : default_target
|
||||||
|
|
||||||
|
#=============================================================================
|
||||||
|
# Special targets provided by cmake.
|
||||||
|
|
||||||
|
# Disable implicit rules so canoncical targets will work.
|
||||||
|
.SUFFIXES:
|
||||||
|
|
||||||
|
# Remove some rules from gmake that .SUFFIXES does not remove.
|
||||||
|
SUFFIXES =
|
||||||
|
|
||||||
|
.SUFFIXES: .hpux_make_needs_suffix_list
|
||||||
|
|
||||||
|
# Suppress display of executed commands.
|
||||||
|
$(VERBOSE).SILENT:
|
||||||
|
|
||||||
|
# A target that is always out of date.
|
||||||
|
cmake_force:
|
||||||
|
.PHONY : cmake_force
|
||||||
|
|
||||||
|
#=============================================================================
|
||||||
|
# Set environment variables for the build.
|
||||||
|
|
||||||
|
# The shell in which to execute make rules.
|
||||||
|
SHELL = /bin/sh
|
||||||
|
|
||||||
|
# The CMake executable.
|
||||||
|
CMAKE_COMMAND = /usr/bin/cmake
|
||||||
|
|
||||||
|
# The command to remove a file.
|
||||||
|
RM = /usr/bin/cmake -E remove -f
|
||||||
|
|
||||||
|
# The program to use to edit the cache.
|
||||||
|
CMAKE_EDIT_COMMAND = /usr/bin/ccmake
|
||||||
|
|
||||||
|
# The top-level source directory on which CMake was run.
|
||||||
|
CMAKE_SOURCE_DIR = /home/peri4/pprojects/pip
|
||||||
|
|
||||||
|
# The top-level build directory on which CMake was run.
|
||||||
|
CMAKE_BINARY_DIR = /home/peri4/pprojects/pip
|
||||||
|
|
||||||
|
#=============================================================================
|
||||||
|
# Targets provided globally by CMake.
|
||||||
|
|
||||||
|
# Special rule for the target edit_cache
|
||||||
|
edit_cache:
|
||||||
|
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..."
|
||||||
|
/usr/bin/ccmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
|
||||||
|
.PHONY : edit_cache
|
||||||
|
|
||||||
|
# Special rule for the target edit_cache
|
||||||
|
edit_cache/fast: edit_cache
|
||||||
|
.PHONY : edit_cache/fast
|
||||||
|
|
||||||
|
# Special rule for the target rebuild_cache
|
||||||
|
rebuild_cache:
|
||||||
|
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
|
||||||
|
/usr/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
|
||||||
|
.PHONY : rebuild_cache
|
||||||
|
|
||||||
|
# Special rule for the target rebuild_cache
|
||||||
|
rebuild_cache/fast: rebuild_cache
|
||||||
|
.PHONY : rebuild_cache/fast
|
||||||
|
|
||||||
|
# The main all target
|
||||||
|
all: cmake_check_build_system
|
||||||
|
$(CMAKE_COMMAND) -E cmake_progress_start /home/peri4/pprojects/pip/CMakeFiles /home/peri4/pprojects/pip/CMakeFiles/progress.marks
|
||||||
|
$(MAKE) -f CMakeFiles/Makefile2 all
|
||||||
|
$(CMAKE_COMMAND) -E cmake_progress_start /home/peri4/pprojects/pip/CMakeFiles 0
|
||||||
|
.PHONY : all
|
||||||
|
|
||||||
|
# The main clean target
|
||||||
|
clean:
|
||||||
|
$(MAKE) -f CMakeFiles/Makefile2 clean
|
||||||
|
.PHONY : clean
|
||||||
|
|
||||||
|
# The main clean target
|
||||||
|
clean/fast: clean
|
||||||
|
.PHONY : clean/fast
|
||||||
|
|
||||||
|
# Prepare targets for installation.
|
||||||
|
preinstall: all
|
||||||
|
$(MAKE) -f CMakeFiles/Makefile2 preinstall
|
||||||
|
.PHONY : preinstall
|
||||||
|
|
||||||
|
# Prepare targets for installation.
|
||||||
|
preinstall/fast:
|
||||||
|
$(MAKE) -f CMakeFiles/Makefile2 preinstall
|
||||||
|
.PHONY : preinstall/fast
|
||||||
|
|
||||||
|
# clear depends
|
||||||
|
depend:
|
||||||
|
$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
|
||||||
|
.PHONY : depend
|
||||||
|
|
||||||
|
#=============================================================================
|
||||||
|
# Target rules for targets named pip
|
||||||
|
|
||||||
|
# Build rule for target.
|
||||||
|
pip: cmake_check_build_system
|
||||||
|
$(MAKE) -f CMakeFiles/Makefile2 pip
|
||||||
|
.PHONY : pip
|
||||||
|
|
||||||
|
# fast build rule for target.
|
||||||
|
pip/fast:
|
||||||
|
$(MAKE) -f CMakeFiles/pip.dir/build.make CMakeFiles/pip.dir/build
|
||||||
|
.PHONY : pip/fast
|
||||||
|
|
||||||
|
main.o: main.cpp.o
|
||||||
|
.PHONY : main.o
|
||||||
|
|
||||||
|
# target to build an object file
|
||||||
|
main.cpp.o:
|
||||||
|
$(MAKE) -f CMakeFiles/pip.dir/build.make CMakeFiles/pip.dir/main.cpp.o
|
||||||
|
.PHONY : main.cpp.o
|
||||||
|
|
||||||
|
main.i: main.cpp.i
|
||||||
|
.PHONY : main.i
|
||||||
|
|
||||||
|
# target to preprocess a source file
|
||||||
|
main.cpp.i:
|
||||||
|
$(MAKE) -f CMakeFiles/pip.dir/build.make CMakeFiles/pip.dir/main.cpp.i
|
||||||
|
.PHONY : main.cpp.i
|
||||||
|
|
||||||
|
main.s: main.cpp.s
|
||||||
|
.PHONY : main.s
|
||||||
|
|
||||||
|
# target to generate assembly for a file
|
||||||
|
main.cpp.s:
|
||||||
|
$(MAKE) -f CMakeFiles/pip.dir/build.make CMakeFiles/pip.dir/main.cpp.s
|
||||||
|
.PHONY : main.cpp.s
|
||||||
|
|
||||||
|
piconfig.o: piconfig.cpp.o
|
||||||
|
.PHONY : piconfig.o
|
||||||
|
|
||||||
|
# target to build an object file
|
||||||
|
piconfig.cpp.o:
|
||||||
|
$(MAKE) -f CMakeFiles/pip.dir/build.make CMakeFiles/pip.dir/piconfig.cpp.o
|
||||||
|
.PHONY : piconfig.cpp.o
|
||||||
|
|
||||||
|
piconfig.i: piconfig.cpp.i
|
||||||
|
.PHONY : piconfig.i
|
||||||
|
|
||||||
|
# target to preprocess a source file
|
||||||
|
piconfig.cpp.i:
|
||||||
|
$(MAKE) -f CMakeFiles/pip.dir/build.make CMakeFiles/pip.dir/piconfig.cpp.i
|
||||||
|
.PHONY : piconfig.cpp.i
|
||||||
|
|
||||||
|
piconfig.s: piconfig.cpp.s
|
||||||
|
.PHONY : piconfig.s
|
||||||
|
|
||||||
|
# target to generate assembly for a file
|
||||||
|
piconfig.cpp.s:
|
||||||
|
$(MAKE) -f CMakeFiles/pip.dir/build.make CMakeFiles/pip.dir/piconfig.cpp.s
|
||||||
|
.PHONY : piconfig.cpp.s
|
||||||
|
|
||||||
|
piconsole.o: piconsole.cpp.o
|
||||||
|
.PHONY : piconsole.o
|
||||||
|
|
||||||
|
# target to build an object file
|
||||||
|
piconsole.cpp.o:
|
||||||
|
$(MAKE) -f CMakeFiles/pip.dir/build.make CMakeFiles/pip.dir/piconsole.cpp.o
|
||||||
|
.PHONY : piconsole.cpp.o
|
||||||
|
|
||||||
|
piconsole.i: piconsole.cpp.i
|
||||||
|
.PHONY : piconsole.i
|
||||||
|
|
||||||
|
# target to preprocess a source file
|
||||||
|
piconsole.cpp.i:
|
||||||
|
$(MAKE) -f CMakeFiles/pip.dir/build.make CMakeFiles/pip.dir/piconsole.cpp.i
|
||||||
|
.PHONY : piconsole.cpp.i
|
||||||
|
|
||||||
|
piconsole.s: piconsole.cpp.s
|
||||||
|
.PHONY : piconsole.s
|
||||||
|
|
||||||
|
# target to generate assembly for a file
|
||||||
|
piconsole.cpp.s:
|
||||||
|
$(MAKE) -f CMakeFiles/pip.dir/build.make CMakeFiles/pip.dir/piconsole.cpp.s
|
||||||
|
.PHONY : piconsole.cpp.s
|
||||||
|
|
||||||
|
piethernet.o: piethernet.cpp.o
|
||||||
|
.PHONY : piethernet.o
|
||||||
|
|
||||||
|
# target to build an object file
|
||||||
|
piethernet.cpp.o:
|
||||||
|
$(MAKE) -f CMakeFiles/pip.dir/build.make CMakeFiles/pip.dir/piethernet.cpp.o
|
||||||
|
.PHONY : piethernet.cpp.o
|
||||||
|
|
||||||
|
piethernet.i: piethernet.cpp.i
|
||||||
|
.PHONY : piethernet.i
|
||||||
|
|
||||||
|
# target to preprocess a source file
|
||||||
|
piethernet.cpp.i:
|
||||||
|
$(MAKE) -f CMakeFiles/pip.dir/build.make CMakeFiles/pip.dir/piethernet.cpp.i
|
||||||
|
.PHONY : piethernet.cpp.i
|
||||||
|
|
||||||
|
piethernet.s: piethernet.cpp.s
|
||||||
|
.PHONY : piethernet.s
|
||||||
|
|
||||||
|
# target to generate assembly for a file
|
||||||
|
piethernet.cpp.s:
|
||||||
|
$(MAKE) -f CMakeFiles/pip.dir/build.make CMakeFiles/pip.dir/piethernet.cpp.s
|
||||||
|
.PHONY : piethernet.cpp.s
|
||||||
|
|
||||||
|
pifile.o: pifile.cpp.o
|
||||||
|
.PHONY : pifile.o
|
||||||
|
|
||||||
|
# target to build an object file
|
||||||
|
pifile.cpp.o:
|
||||||
|
$(MAKE) -f CMakeFiles/pip.dir/build.make CMakeFiles/pip.dir/pifile.cpp.o
|
||||||
|
.PHONY : pifile.cpp.o
|
||||||
|
|
||||||
|
pifile.i: pifile.cpp.i
|
||||||
|
.PHONY : pifile.i
|
||||||
|
|
||||||
|
# target to preprocess a source file
|
||||||
|
pifile.cpp.i:
|
||||||
|
$(MAKE) -f CMakeFiles/pip.dir/build.make CMakeFiles/pip.dir/pifile.cpp.i
|
||||||
|
.PHONY : pifile.cpp.i
|
||||||
|
|
||||||
|
pifile.s: pifile.cpp.s
|
||||||
|
.PHONY : pifile.s
|
||||||
|
|
||||||
|
# target to generate assembly for a file
|
||||||
|
pifile.cpp.s:
|
||||||
|
$(MAKE) -f CMakeFiles/pip.dir/build.make CMakeFiles/pip.dir/pifile.cpp.s
|
||||||
|
.PHONY : pifile.cpp.s
|
||||||
|
|
||||||
|
pikbdlistener.o: pikbdlistener.cpp.o
|
||||||
|
.PHONY : pikbdlistener.o
|
||||||
|
|
||||||
|
# target to build an object file
|
||||||
|
pikbdlistener.cpp.o:
|
||||||
|
$(MAKE) -f CMakeFiles/pip.dir/build.make CMakeFiles/pip.dir/pikbdlistener.cpp.o
|
||||||
|
.PHONY : pikbdlistener.cpp.o
|
||||||
|
|
||||||
|
pikbdlistener.i: pikbdlistener.cpp.i
|
||||||
|
.PHONY : pikbdlistener.i
|
||||||
|
|
||||||
|
# target to preprocess a source file
|
||||||
|
pikbdlistener.cpp.i:
|
||||||
|
$(MAKE) -f CMakeFiles/pip.dir/build.make CMakeFiles/pip.dir/pikbdlistener.cpp.i
|
||||||
|
.PHONY : pikbdlistener.cpp.i
|
||||||
|
|
||||||
|
pikbdlistener.s: pikbdlistener.cpp.s
|
||||||
|
.PHONY : pikbdlistener.s
|
||||||
|
|
||||||
|
# target to generate assembly for a file
|
||||||
|
pikbdlistener.cpp.s:
|
||||||
|
$(MAKE) -f CMakeFiles/pip.dir/build.make CMakeFiles/pip.dir/pikbdlistener.cpp.s
|
||||||
|
.PHONY : pikbdlistener.cpp.s
|
||||||
|
|
||||||
|
piprotocol.o: piprotocol.cpp.o
|
||||||
|
.PHONY : piprotocol.o
|
||||||
|
|
||||||
|
# target to build an object file
|
||||||
|
piprotocol.cpp.o:
|
||||||
|
$(MAKE) -f CMakeFiles/pip.dir/build.make CMakeFiles/pip.dir/piprotocol.cpp.o
|
||||||
|
.PHONY : piprotocol.cpp.o
|
||||||
|
|
||||||
|
piprotocol.i: piprotocol.cpp.i
|
||||||
|
.PHONY : piprotocol.i
|
||||||
|
|
||||||
|
# target to preprocess a source file
|
||||||
|
piprotocol.cpp.i:
|
||||||
|
$(MAKE) -f CMakeFiles/pip.dir/build.make CMakeFiles/pip.dir/piprotocol.cpp.i
|
||||||
|
.PHONY : piprotocol.cpp.i
|
||||||
|
|
||||||
|
piprotocol.s: piprotocol.cpp.s
|
||||||
|
.PHONY : piprotocol.s
|
||||||
|
|
||||||
|
# target to generate assembly for a file
|
||||||
|
piprotocol.cpp.s:
|
||||||
|
$(MAKE) -f CMakeFiles/pip.dir/build.make CMakeFiles/pip.dir/piprotocol.cpp.s
|
||||||
|
.PHONY : piprotocol.cpp.s
|
||||||
|
|
||||||
|
piserial.o: piserial.cpp.o
|
||||||
|
.PHONY : piserial.o
|
||||||
|
|
||||||
|
# target to build an object file
|
||||||
|
piserial.cpp.o:
|
||||||
|
$(MAKE) -f CMakeFiles/pip.dir/build.make CMakeFiles/pip.dir/piserial.cpp.o
|
||||||
|
.PHONY : piserial.cpp.o
|
||||||
|
|
||||||
|
piserial.i: piserial.cpp.i
|
||||||
|
.PHONY : piserial.i
|
||||||
|
|
||||||
|
# target to preprocess a source file
|
||||||
|
piserial.cpp.i:
|
||||||
|
$(MAKE) -f CMakeFiles/pip.dir/build.make CMakeFiles/pip.dir/piserial.cpp.i
|
||||||
|
.PHONY : piserial.cpp.i
|
||||||
|
|
||||||
|
piserial.s: piserial.cpp.s
|
||||||
|
.PHONY : piserial.s
|
||||||
|
|
||||||
|
# target to generate assembly for a file
|
||||||
|
piserial.cpp.s:
|
||||||
|
$(MAKE) -f CMakeFiles/pip.dir/build.make CMakeFiles/pip.dir/piserial.cpp.s
|
||||||
|
.PHONY : piserial.cpp.s
|
||||||
|
|
||||||
|
pistring.o: pistring.cpp.o
|
||||||
|
.PHONY : pistring.o
|
||||||
|
|
||||||
|
# target to build an object file
|
||||||
|
pistring.cpp.o:
|
||||||
|
$(MAKE) -f CMakeFiles/pip.dir/build.make CMakeFiles/pip.dir/pistring.cpp.o
|
||||||
|
.PHONY : pistring.cpp.o
|
||||||
|
|
||||||
|
pistring.i: pistring.cpp.i
|
||||||
|
.PHONY : pistring.i
|
||||||
|
|
||||||
|
# target to preprocess a source file
|
||||||
|
pistring.cpp.i:
|
||||||
|
$(MAKE) -f CMakeFiles/pip.dir/build.make CMakeFiles/pip.dir/pistring.cpp.i
|
||||||
|
.PHONY : pistring.cpp.i
|
||||||
|
|
||||||
|
pistring.s: pistring.cpp.s
|
||||||
|
.PHONY : pistring.s
|
||||||
|
|
||||||
|
# target to generate assembly for a file
|
||||||
|
pistring.cpp.s:
|
||||||
|
$(MAKE) -f CMakeFiles/pip.dir/build.make CMakeFiles/pip.dir/pistring.cpp.s
|
||||||
|
.PHONY : pistring.cpp.s
|
||||||
|
|
||||||
|
pithread.o: pithread.cpp.o
|
||||||
|
.PHONY : pithread.o
|
||||||
|
|
||||||
|
# target to build an object file
|
||||||
|
pithread.cpp.o:
|
||||||
|
$(MAKE) -f CMakeFiles/pip.dir/build.make CMakeFiles/pip.dir/pithread.cpp.o
|
||||||
|
.PHONY : pithread.cpp.o
|
||||||
|
|
||||||
|
pithread.i: pithread.cpp.i
|
||||||
|
.PHONY : pithread.i
|
||||||
|
|
||||||
|
# target to preprocess a source file
|
||||||
|
pithread.cpp.i:
|
||||||
|
$(MAKE) -f CMakeFiles/pip.dir/build.make CMakeFiles/pip.dir/pithread.cpp.i
|
||||||
|
.PHONY : pithread.cpp.i
|
||||||
|
|
||||||
|
pithread.s: pithread.cpp.s
|
||||||
|
.PHONY : pithread.s
|
||||||
|
|
||||||
|
# target to generate assembly for a file
|
||||||
|
pithread.cpp.s:
|
||||||
|
$(MAKE) -f CMakeFiles/pip.dir/build.make CMakeFiles/pip.dir/pithread.cpp.s
|
||||||
|
.PHONY : pithread.cpp.s
|
||||||
|
|
||||||
|
pitimer.o: pitimer.cpp.o
|
||||||
|
.PHONY : pitimer.o
|
||||||
|
|
||||||
|
# target to build an object file
|
||||||
|
pitimer.cpp.o:
|
||||||
|
$(MAKE) -f CMakeFiles/pip.dir/build.make CMakeFiles/pip.dir/pitimer.cpp.o
|
||||||
|
.PHONY : pitimer.cpp.o
|
||||||
|
|
||||||
|
pitimer.i: pitimer.cpp.i
|
||||||
|
.PHONY : pitimer.i
|
||||||
|
|
||||||
|
# target to preprocess a source file
|
||||||
|
pitimer.cpp.i:
|
||||||
|
$(MAKE) -f CMakeFiles/pip.dir/build.make CMakeFiles/pip.dir/pitimer.cpp.i
|
||||||
|
.PHONY : pitimer.cpp.i
|
||||||
|
|
||||||
|
pitimer.s: pitimer.cpp.s
|
||||||
|
.PHONY : pitimer.s
|
||||||
|
|
||||||
|
# target to generate assembly for a file
|
||||||
|
pitimer.cpp.s:
|
||||||
|
$(MAKE) -f CMakeFiles/pip.dir/build.make CMakeFiles/pip.dir/pitimer.cpp.s
|
||||||
|
.PHONY : pitimer.cpp.s
|
||||||
|
|
||||||
|
pivariable.o: pivariable.cpp.o
|
||||||
|
.PHONY : pivariable.o
|
||||||
|
|
||||||
|
# target to build an object file
|
||||||
|
pivariable.cpp.o:
|
||||||
|
$(MAKE) -f CMakeFiles/pip.dir/build.make CMakeFiles/pip.dir/pivariable.cpp.o
|
||||||
|
.PHONY : pivariable.cpp.o
|
||||||
|
|
||||||
|
pivariable.i: pivariable.cpp.i
|
||||||
|
.PHONY : pivariable.i
|
||||||
|
|
||||||
|
# target to preprocess a source file
|
||||||
|
pivariable.cpp.i:
|
||||||
|
$(MAKE) -f CMakeFiles/pip.dir/build.make CMakeFiles/pip.dir/pivariable.cpp.i
|
||||||
|
.PHONY : pivariable.cpp.i
|
||||||
|
|
||||||
|
pivariable.s: pivariable.cpp.s
|
||||||
|
.PHONY : pivariable.s
|
||||||
|
|
||||||
|
# target to generate assembly for a file
|
||||||
|
pivariable.cpp.s:
|
||||||
|
$(MAKE) -f CMakeFiles/pip.dir/build.make CMakeFiles/pip.dir/pivariable.cpp.s
|
||||||
|
.PHONY : pivariable.cpp.s
|
||||||
|
|
||||||
|
# Help Target
|
||||||
|
help:
|
||||||
|
@echo "The following are some of the valid targets for this Makefile:"
|
||||||
|
@echo "... all (the default if no target is provided)"
|
||||||
|
@echo "... clean"
|
||||||
|
@echo "... depend"
|
||||||
|
@echo "... edit_cache"
|
||||||
|
@echo "... pip"
|
||||||
|
@echo "... rebuild_cache"
|
||||||
|
@echo "... main.o"
|
||||||
|
@echo "... main.i"
|
||||||
|
@echo "... main.s"
|
||||||
|
@echo "... piconfig.o"
|
||||||
|
@echo "... piconfig.i"
|
||||||
|
@echo "... piconfig.s"
|
||||||
|
@echo "... piconsole.o"
|
||||||
|
@echo "... piconsole.i"
|
||||||
|
@echo "... piconsole.s"
|
||||||
|
@echo "... piethernet.o"
|
||||||
|
@echo "... piethernet.i"
|
||||||
|
@echo "... piethernet.s"
|
||||||
|
@echo "... pifile.o"
|
||||||
|
@echo "... pifile.i"
|
||||||
|
@echo "... pifile.s"
|
||||||
|
@echo "... pikbdlistener.o"
|
||||||
|
@echo "... pikbdlistener.i"
|
||||||
|
@echo "... pikbdlistener.s"
|
||||||
|
@echo "... piprotocol.o"
|
||||||
|
@echo "... piprotocol.i"
|
||||||
|
@echo "... piprotocol.s"
|
||||||
|
@echo "... piserial.o"
|
||||||
|
@echo "... piserial.i"
|
||||||
|
@echo "... piserial.s"
|
||||||
|
@echo "... pistring.o"
|
||||||
|
@echo "... pistring.i"
|
||||||
|
@echo "... pistring.s"
|
||||||
|
@echo "... pithread.o"
|
||||||
|
@echo "... pithread.i"
|
||||||
|
@echo "... pithread.s"
|
||||||
|
@echo "... pitimer.o"
|
||||||
|
@echo "... pitimer.i"
|
||||||
|
@echo "... pitimer.s"
|
||||||
|
@echo "... pivariable.o"
|
||||||
|
@echo "... pivariable.i"
|
||||||
|
@echo "... pivariable.s"
|
||||||
|
.PHONY : help
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#=============================================================================
|
||||||
|
# Special targets to cleanup operation of make.
|
||||||
|
|
||||||
|
# Special rule to run CMake to check the build system integrity.
|
||||||
|
# No rule that depends on this can have commands that come from listfiles
|
||||||
|
# because they might be regenerated.
|
||||||
|
cmake_check_build_system:
|
||||||
|
$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
|
||||||
|
.PHONY : cmake_check_build_system
|
||||||
|
|
||||||
7
main.cpp
7
main.cpp
@@ -1,5 +1,10 @@
|
|||||||
#include "pip.h"
|
#include "pip.h"
|
||||||
|
|
||||||
int main(int argc, char * argv[]) {
|
int main(int argc, char * argv[]) {
|
||||||
cout << PIString("Hello PIP!") << endl;
|
PIMathMatrix<3, 2> m0(1., 2., 3.,
|
||||||
|
4., 5., 6.);
|
||||||
|
PIMathMatrix<3, 2> m1(1., -2., 3.,
|
||||||
|
-4., 5., -6.);
|
||||||
|
m0 += m1;
|
||||||
|
cout << m0 << endl;
|
||||||
};
|
};
|
||||||
|
|||||||
18
piconfig.cpp
18
piconfig.cpp
@@ -1,8 +1,8 @@
|
|||||||
#include "piconfig.h"
|
#include "piconfig.h"
|
||||||
|
|
||||||
|
|
||||||
PIConfig::PIConfig(const PIString & path): PIFile(path) {
|
PIConfig::PIConfig(const PIString & path, Flags<Mode> mode): PIFile(path, mode) {
|
||||||
if (!isOpened())
|
if (!isOpened() && (mode[Write] || mode[New]))
|
||||||
open(path, Read | Write | New);
|
open(path, Read | Write | New);
|
||||||
parse();
|
parse();
|
||||||
}
|
}
|
||||||
@@ -110,14 +110,14 @@ void PIConfig::insertLine(uint number, const PIString & name, const PIString & v
|
|||||||
addLine(name, value, type);
|
addLine(name, value, type);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
settname.insert(settname.begin() + number, name);
|
settname.insert(number, name);
|
||||||
settval.insert(settval.begin() + number, value);
|
settval.insert(number, value);
|
||||||
settcom.insert(settcom.begin() + number, "");
|
settcom.insert(number, "");
|
||||||
setttab.insert(setttab.begin() + number, setttab[number]);
|
setttab.insert(number, setttab[number]);
|
||||||
setttype.insert(setttype.begin() + number, type);
|
setttype.insert(number, type);
|
||||||
settlines.insert(settlines.begin() + number, settlines[number]);
|
settlines.insert(number, settlines[number]);
|
||||||
for (uint i = number + 1; i < settlines.size(); i++) settlines[i]++;
|
for (uint i = number + 1; i < settlines.size(); i++) settlines[i]++;
|
||||||
all.insert(all.begin() + settlines[number], name + " = " + value + " #" + type);
|
all.insert(settlines[number], name + " = " + value + " #" + type);
|
||||||
flush();
|
flush();
|
||||||
writeAll();
|
writeAll();
|
||||||
}
|
}
|
||||||
|
|||||||
16
piconfig.h
16
piconfig.h
@@ -6,7 +6,7 @@
|
|||||||
class PIConfig: public PIFile
|
class PIConfig: public PIFile
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PIConfig(const PIString & path);
|
PIConfig(const PIString & path, Flags<Mode> mode = Read | Write);
|
||||||
~PIConfig() {;}
|
~PIConfig() {;}
|
||||||
|
|
||||||
PIString getValue(const PIString & vname, const PIString & def = "", bool * exist = 0) const;
|
PIString getValue(const PIString & vname, const PIString & def = "", bool * exist = 0) const;
|
||||||
@@ -58,13 +58,13 @@ public:
|
|||||||
private:
|
private:
|
||||||
void parse();
|
void parse();
|
||||||
|
|
||||||
vector<PIString> settname;
|
PIVector<PIString> settname;
|
||||||
vector<PIString> settval;
|
PIVector<PIString> settval;
|
||||||
vector<PIString> settcom;
|
PIVector<PIString> settcom;
|
||||||
vector<PIString> setttab;
|
PIVector<PIString> setttab;
|
||||||
vector<PIString> setttype;
|
PIVector<PIString> setttype;
|
||||||
vector<PIString> all;
|
PIVector<PIString> all;
|
||||||
vector<uint> settlines;
|
PIVector<uint> settlines;
|
||||||
uint lines;
|
uint lines;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -13,30 +13,46 @@ PIEthernet::PIEthernet(PIString ip, int port, void * data_, EthernetFunc slot):
|
|||||||
WSADATA wsaData;
|
WSADATA wsaData;
|
||||||
WSAStartup(MAKEWORD(2, 2), &wsaData);
|
WSAStartup(MAKEWORD(2, 2), &wsaData);
|
||||||
#endif
|
#endif
|
||||||
sock = socket(PF_INET, SOCK_DGRAM, 0);
|
initSend();
|
||||||
sock_s = socket(PF_INET, SOCK_DGRAM, 0);
|
|
||||||
if (sock == -1 || sock_s == -1)
|
|
||||||
cout << "[PIEthernet] Unable to create socket" << endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PIEthernet::~PIEthernet() {
|
PIEthernet::~PIEthernet() {
|
||||||
if (isRunning()) {
|
terminate();
|
||||||
stop();
|
|
||||||
pthread_cancel(thread);
|
|
||||||
}
|
|
||||||
if (sock != -1) {
|
|
||||||
shutdown(sock, SHUT_RDWR);
|
|
||||||
close(sock);
|
|
||||||
}
|
|
||||||
if (sock_s != -1) {
|
|
||||||
shutdown(sock_s, SHUT_RDWR);
|
|
||||||
close(sock_s);
|
|
||||||
}
|
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
WSACleanup();
|
WSACleanup();
|
||||||
#endif
|
#endif
|
||||||
delete buffer;
|
delete buffer;
|
||||||
|
if (sock != -1) {
|
||||||
|
shutdown(sock, SHUT_RDWR);
|
||||||
|
close(sock);
|
||||||
|
sock = -1;
|
||||||
|
}
|
||||||
|
if (sock_s != -1) {
|
||||||
|
shutdown(sock_s, SHUT_RDWR);
|
||||||
|
close(sock_s);
|
||||||
|
sock_s = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PIEthernet::terminate() {
|
||||||
|
if (!initialized()) return;
|
||||||
|
if (isRunning()) {
|
||||||
|
stop();
|
||||||
|
pthread_cancel(thread);
|
||||||
|
}
|
||||||
|
/*if (sock != -1) {
|
||||||
|
shutdown(sock, SHUT_RDWR);
|
||||||
|
shutdown(sock, SHUT_RDWR);
|
||||||
|
close(sock);
|
||||||
|
sock = -1;
|
||||||
|
}
|
||||||
|
if (sock_s != -1) {
|
||||||
|
shutdown(sock_s, SHUT_RDWR);
|
||||||
|
close(sock_s);
|
||||||
|
sock_s = -1;
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -65,26 +81,29 @@ void PIEthernet::run() {
|
|||||||
|
|
||||||
|
|
||||||
void PIEthernet::end() {
|
void PIEthernet::end() {
|
||||||
if (sock != -1) {
|
terminate();
|
||||||
shutdown(sock, SHUT_RDWR);
|
|
||||||
close(sock);
|
|
||||||
sock = -1;
|
|
||||||
}
|
|
||||||
if (sock_s != -1) {
|
|
||||||
shutdown(sock_s, SHUT_RDWR);
|
|
||||||
close(sock_s);
|
|
||||||
sock_s = -1;
|
|
||||||
}
|
|
||||||
//cout << "[PIEthernet] end" << endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool PIEthernet::init() {
|
bool PIEthernet::init() {
|
||||||
addr_.sin_addr.s_addr = inet_addr(ip_.data());
|
addr_.sin_addr.s_addr = inet_addr(ip_.stdString().data());
|
||||||
addr_.sin_family = PF_INET;
|
addr_.sin_family = PF_INET;
|
||||||
addr_.sin_port = htons(port_);
|
addr_.sin_port = htons(port_);
|
||||||
|
close(sock);
|
||||||
|
sock = socket(PF_INET, SOCK_DGRAM, 0);
|
||||||
if (bind(sock, (sockaddr * )&addr_, sizeof(addr_)) == -1) {
|
if (bind(sock, (sockaddr * )&addr_, sizeof(addr_)) == -1) {
|
||||||
cout << "[PIEthernet] Cant`t bind to " << ip_ << ":" << port_ << endl;
|
cout << "[PIEthernet] Cant`t bind to " << ip_.stdString() << ":" << port_ << endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool PIEthernet::initSend() {
|
||||||
|
close(sock_s);
|
||||||
|
sock_s = socket(PF_INET, SOCK_DGRAM, 0);
|
||||||
|
if (sock_s == -1) {
|
||||||
|
cout << "[PIEthernet] Unable to create socket" << endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -97,7 +116,7 @@ bool PIEthernet::send(PIString ip, int port, char * data, int size) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
saddr_.sin_port = htons(port);
|
saddr_.sin_port = htons(port);
|
||||||
saddr_.sin_addr.s_addr = inet_addr(ip.data());
|
saddr_.sin_addr.s_addr = inet_addr(ip.stdString().data());
|
||||||
saddr_.sin_family = PF_INET;
|
saddr_.sin_family = PF_INET;
|
||||||
wrote = sendto(sock_s, data, size, 0, (sockaddr * )&saddr_, sizeof(saddr_));
|
wrote = sendto(sock_s, data, size, 0, (sockaddr * )&saddr_, sizeof(saddr_));
|
||||||
if (wrote != size) {
|
if (wrote != size) {
|
||||||
@@ -115,7 +134,7 @@ bool PIEthernet::send(char * data, int size) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
saddr_.sin_port = htons(port_s);
|
saddr_.sin_port = htons(port_s);
|
||||||
saddr_.sin_addr.s_addr = inet_addr(ip_s.data());
|
saddr_.sin_addr.s_addr = inet_addr(ip_s.stdString().data());
|
||||||
saddr_.sin_family = PF_INET;
|
saddr_.sin_family = PF_INET;
|
||||||
//cout << "[PIEthernet] sending in " << sock_s << endl;
|
//cout << "[PIEthernet] sending in " << sock_s << endl;
|
||||||
wrote = sendto(sock_s, data, size, 0, (sockaddr * )&saddr_, sizeof(saddr_));
|
wrote = sendto(sock_s, data, size, 0, (sockaddr * )&saddr_, sizeof(saddr_));
|
||||||
|
|||||||
@@ -20,17 +20,20 @@ class PIEthernet: public PIThread
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// slot is any function format "bool <func>(void*, char*)"
|
// slot is any function format "bool <func>(void*, char*)"
|
||||||
PIEthernet(PIString ip, int port, void * data, EthernetFunc slot = 0);
|
PIEthernet(PIString ip = "", int port = 0, void * data = 0, EthernetFunc slot = 0);
|
||||||
~PIEthernet();
|
~PIEthernet();
|
||||||
|
|
||||||
void setSlot(EthernetFunc func) {ret_func = func;}
|
void setSlot(EthernetFunc func) {ret_func = func;}
|
||||||
|
void setData(void * d) {data = d;}
|
||||||
void setReadAddress(PIString ip, int port) {ip_ = ip; port_ = port;}
|
void setReadAddress(PIString ip, int port) {ip_ = ip; port_ = port;}
|
||||||
void setSendAddress(PIString ip, int port) {ip_s = ip; port_s = port;}
|
void setSendAddress(PIString ip, int port) {ip_s = ip; port_s = port;}
|
||||||
|
|
||||||
bool send(PIString ip, int port, char * data, int size);
|
bool send(PIString ip, int port, char * data, int size);
|
||||||
bool send(char * data, int size);
|
bool send(char * data, int size);
|
||||||
bool init();
|
bool init();
|
||||||
|
bool initSend();
|
||||||
bool initialized() const {return sock != -1;}
|
bool initialized() const {return sock != -1;}
|
||||||
|
void terminate();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void begin();
|
void begin();
|
||||||
|
|||||||
@@ -4,12 +4,13 @@
|
|||||||
bool PIFile::open(const PIString & path_, Flags<Mode> mode_) {
|
bool PIFile::open(const PIString & path_, Flags<Mode> mode_) {
|
||||||
cpath = path_;
|
cpath = path_;
|
||||||
cmode = mode_;
|
cmode = mode_;
|
||||||
|
string st = cpath.stdString();
|
||||||
if (cmode[New]) {
|
if (cmode[New]) {
|
||||||
stream.open(cpath.stdString().c_str(), fstream::in | fstream::out | fstream::trunc);
|
stream.open(st.c_str(), fstream::in | fstream::out | fstream::trunc | fstream::binary);
|
||||||
stream.close();
|
stream.close();
|
||||||
cmode &= ~New;
|
cmode &= ~New;
|
||||||
stream.open(cpath.stdString().c_str(), (fstream::openmode)(int)cmode | fstream::binary);
|
stream.open(st.c_str(), (fstream::openmode)(int)cmode | fstream::binary);
|
||||||
} else stream.open(cpath.stdString().c_str(), (fstream::openmode)(int)cmode | fstream::binary);
|
} else stream.open(st.c_str(), (fstream::openmode)(int)cmode | fstream::binary);
|
||||||
return isOpened();
|
return isOpened();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
12
pifile.h
12
pifile.h
@@ -11,17 +11,21 @@ class PIFile
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PIFile() {;}
|
PIFile() {;}
|
||||||
|
|
||||||
enum Mode {Read = fstream::in, Write = fstream::out, Truncate = fstream::trunc, New = fstream::app};
|
enum Mode {Read = fstream::in, Write = fstream::out, Truncate = fstream::trunc, New = fstream::app};
|
||||||
|
|
||||||
PIFile(const PIString & path, Flags<Mode> mode = Read | Write) {open(path, mode);}
|
PIFile(const PIString & path, Flags<Mode> mode = Read | Write) {open(path, mode);}
|
||||||
|
PIFile(const PIFile & file) {cpath = file.cpath; cmode = file.cmode;}
|
||||||
~PIFile() {if (isOpened()) close();}
|
~PIFile() {if (isOpened()) close();}
|
||||||
|
|
||||||
bool open(const PIString & path, Flags<Mode> mode = Read | Write);
|
bool open(const PIString & path, Flags<Mode> mode = Read | Write);
|
||||||
void close() {stream.close();}
|
inline void close() {stream.close();}
|
||||||
void clear() {close(); stream.open(cpath.stdString().c_str(), fstream::trunc | (fstream::openmode)(int)cmode);}
|
inline void clear() {string st = cpath.stdString(); close(); stream.open(st.c_str(), fstream::trunc | fstream::binary | (fstream::openmode)(int)cmode);}
|
||||||
void seek(int position);
|
void seek(int position);
|
||||||
|
inline void seekToEnd() {stream.seekg(0, fstream::end);}
|
||||||
void resize(int new_size, char fill = 0);
|
void resize(int new_size, char fill = 0);
|
||||||
void fill(char c) {stream.fill(c);}
|
inline void fill(char c) {stream.fill(c);}
|
||||||
void flush() {stream.flush();}
|
inline void flush() {stream.flush();}
|
||||||
PIString readLine();
|
PIString readLine();
|
||||||
|
|
||||||
PIString path() const {return cpath;}
|
PIString path() const {return cpath;}
|
||||||
|
|||||||
90
pigeometry.h
Normal file
90
pigeometry.h
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
#ifndef PIGEOMETRY_H
|
||||||
|
#define PIGEOMETRY_H
|
||||||
|
|
||||||
|
#include "pimath.h"
|
||||||
|
|
||||||
|
template<typename Type>
|
||||||
|
class PIPoint {
|
||||||
|
public:
|
||||||
|
Type x;
|
||||||
|
Type y;
|
||||||
|
|
||||||
|
PIPoint() {x = y = 0;};
|
||||||
|
PIPoint(Type x_, Type y_) {set(x_, y_);}
|
||||||
|
|
||||||
|
inline void set(Type x_, Type y_) {x = x_; y = y_;}
|
||||||
|
inline double angleRad() const {return atan2(y, x);}
|
||||||
|
inline int angleDeg() const {return round(atan2(y, x) * 180. / M_PI);}
|
||||||
|
|
||||||
|
inline PIPoint<Type> operator +(const PIPoint<Type> & p) {return PIPoint<Type>(x + p.x, y + p.y);}
|
||||||
|
inline PIPoint<Type> operator +(const Type & p) {return PIPoint<Type>(x + p, y + p);}
|
||||||
|
inline PIPoint<Type> operator -(const PIPoint<Type> & p) {return PIPoint<Type>(x - p.x, y - p.y);}
|
||||||
|
inline PIPoint<Type> operator -(const Type & p) {return PIPoint<Type>(x - p, y - p);}
|
||||||
|
inline PIPoint<Type> operator -() {return PIPoint<Type>(-x, -y);}
|
||||||
|
inline PIPoint<Type> operator *(const Type & d) {return PIPoint<Type>(x * d, y * d);}
|
||||||
|
inline PIPoint<Type> operator /(const Type & d) {return PIPoint<Type>(x / d, y / d);}
|
||||||
|
inline bool operator ==(const PIPoint<Type> & p) const {return (x == p.x && y == p.y);}
|
||||||
|
inline bool operator !=(const PIPoint<Type> & p) const {return (x != p.x || y != p.y);}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename Type>
|
||||||
|
class PIRect {
|
||||||
|
public:
|
||||||
|
Type x0;
|
||||||
|
Type y0;
|
||||||
|
Type x1;
|
||||||
|
Type y1;
|
||||||
|
|
||||||
|
PIRect() {x0 = y0 = x1 = y1 = 0;};
|
||||||
|
PIRect(Type x, Type y, Type w, Type h) {set(x, y, w, h);}
|
||||||
|
PIRect(const PIPoint<Type> & tl, const PIPoint<Type> & br) {set(tl.x, tl.y, br.x, br.y);}
|
||||||
|
|
||||||
|
inline void set(Type x, Type y, Type w, Type h) {x0 = x; y0 = y; x1 = x + w; y1 = y + h;}
|
||||||
|
inline bool pointIn(Type x, Type y) const {return (x <= x1 && x >= x0 && y <= y1 && y >= y0);}
|
||||||
|
inline bool pointIn(const PIPoint<Type> & p) const {return pointIn(p.x, p.y);}
|
||||||
|
inline bool isEmpty() const {return (x1 - x0 == 0 && y1 - y0 == 0);}
|
||||||
|
inline PIRect<Type> & translate(Type x, Type y) {x0 += x; x1 += x; y0 += y; y1 += y; return *this;}
|
||||||
|
inline PIRect<Type> & translate(const PIPoint<Type> & p) {x0 += p.x; x1 += p.x; y0 += p.y; y1 += p.y; return *this;}
|
||||||
|
inline PIRect<Type> translated(Type x, Type y) {PIRect<Type> r(*this); r.translate(x, y); return r;}
|
||||||
|
inline PIRect<Type> translated(const PIPoint<Type> & p) {PIRect<Type> r(*this); r.translate(p); return r;}
|
||||||
|
inline PIRect<Type> & scale(Type x, Type y) {setWidth(width() * x); setHeight(height() * y); return *this;}
|
||||||
|
inline PIRect<Type> & scale(const PIPoint<Type> & p) {setWidth(width() * p.x); setHeight(height() * p.y); return *this;}
|
||||||
|
inline PIRect<Type> scaled(Type x, Type y) {PIRect<Type> r(*this); r.scale(x, y); return r;}
|
||||||
|
inline PIRect<Type> scaled(const PIPoint<Type> & p) {PIRect<Type> r(*this); r.scale(p); return r;}
|
||||||
|
//inline void unite(const PIRect<Type> & r) {;}
|
||||||
|
//inline PIRect<Type> & united(const PIRect<Type> & r) {unite(r); return *this;}
|
||||||
|
inline Type top() const {return y0;}
|
||||||
|
inline Type left() const {return x0;}
|
||||||
|
inline Type right() const {return x1;}
|
||||||
|
inline Type bottom() const {return y1;}
|
||||||
|
inline Type width() const {return x1 - x0;}
|
||||||
|
inline Type height() const {return y1 - y0;}
|
||||||
|
inline PIPoint<Type> topLeft() {return PIPoint<Type>(x0, y0);}
|
||||||
|
inline PIPoint<Type> topRigth() {return PIPoint<Type>(x1, y0);}
|
||||||
|
inline PIPoint<Type> bottomLeft() {return PIPoint<Type>(x0, y1);}
|
||||||
|
inline PIPoint<Type> bottomRight() {return PIPoint<Type>(x1, y1);}
|
||||||
|
inline void setTop(Type v) {y0 = v;}
|
||||||
|
inline void setLeft(Type v) {x0 = v;}
|
||||||
|
inline void setRigth(Type v) {x1 = v;}
|
||||||
|
inline void setBottom(Type v) {y1 = v;}
|
||||||
|
inline void setWidth(Type v) {x1 = x0 + v;}
|
||||||
|
inline void setHeight(Type v) {y1 = y0 + v;}
|
||||||
|
|
||||||
|
inline PIRect<Type> operator -() {return PIRect<Type>(-x0, -y0, -width(), -height());}
|
||||||
|
inline void operator +=(Type x) {translate(x, x);}
|
||||||
|
inline void operator +=(const PIPoint<Type> & p) {translate(p);}
|
||||||
|
inline void operator -=(Type x) {translate(-x, -x);}
|
||||||
|
inline void operator -=(const PIPoint<Type> & p) {translate(-p);}
|
||||||
|
inline void operator *=(Type p) {x0 *= p; x1 *= p; y0 *= p; y1 *= p;}
|
||||||
|
inline void operator /=(Type p) {x0 /= p; x1 /= p; y0 /= p; y1 /= p;}
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef PIPoint<int> PIPointi;
|
||||||
|
typedef PIPoint<float> PIPointf;
|
||||||
|
typedef PIPoint<double> PIPointd;
|
||||||
|
|
||||||
|
typedef PIRect<int> PIRecti;
|
||||||
|
typedef PIRect<float> PIRectf;
|
||||||
|
typedef PIRect<double> PIRectd;
|
||||||
|
|
||||||
|
#endif // PIGEOMETRY_H
|
||||||
17
piincludes.h
17
piincludes.h
@@ -44,6 +44,20 @@ using std::list;
|
|||||||
using std::deque;
|
using std::deque;
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
|
template<typename Type, typename Allocator = std::allocator<Type> >
|
||||||
|
class PIVector: public vector<Type, Allocator> {
|
||||||
|
public:
|
||||||
|
inline const Type & at(uint index) const {return (*this)[index];}
|
||||||
|
inline Type & at(uint index) {return (*this)[index];}
|
||||||
|
inline const Type * data(uint index = 0) const {return &(*this)[index];}
|
||||||
|
inline Type * data(uint index = 0) {return &(*this)[index];}
|
||||||
|
inline void pop_front() {vector<Type, Allocator>::erase(vector<Type, Allocator>::begin());}
|
||||||
|
inline void push_front(const Type & t) {vector<Type, Allocator>::insert(vector<Type, Allocator>::begin(), t);}
|
||||||
|
inline void remove(uint num) {vector<Type, Allocator>::erase(vector<Type, Allocator>::begin() + num);}
|
||||||
|
inline void remove(uint num, uint count) {vector<Type, Allocator>::erase(vector<Type, Allocator>::begin() + num, vector<Type, Allocator>::begin() + num + count);}
|
||||||
|
inline void insert(uint pos, const Type & t) {vector<Type, Allocator>::insert(vector<Type, Allocator>::begin() + pos, t);}
|
||||||
|
};
|
||||||
|
|
||||||
template<typename Enum>
|
template<typename Enum>
|
||||||
class Flags {
|
class Flags {
|
||||||
private:
|
private:
|
||||||
@@ -70,6 +84,9 @@ public:
|
|||||||
inline operator int() const {return flags;}
|
inline operator int() const {return flags;}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef WINDOWS
|
||||||
|
inline int random() {return rand();}
|
||||||
|
#endif
|
||||||
|
|
||||||
inline bool atob(const string & str) { return str == "1" ? true : false;};
|
inline bool atob(const string & str) { return str == "1" ? true : false;};
|
||||||
inline string btos(const bool num) { return num ? "0" : "1";};
|
inline string btos(const bool num) { return num ? "0" : "1";};
|
||||||
|
|||||||
153
pimath.h
Normal file
153
pimath.h
Normal file
@@ -0,0 +1,153 @@
|
|||||||
|
#ifndef PIMathATH_H
|
||||||
|
#define PIMathATH_H
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
#include <complex>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include "piincludes.h"
|
||||||
|
|
||||||
|
using std::complex;
|
||||||
|
|
||||||
|
typedef complex<int> complexi;
|
||||||
|
typedef complex<float> complexf;
|
||||||
|
typedef complex<double> complexd;
|
||||||
|
typedef complex<long double> complexld;
|
||||||
|
|
||||||
|
const double deg2rad = atan(1) / 45.;
|
||||||
|
const double rad2deg = 45. / atan(1);
|
||||||
|
|
||||||
|
inline int pow2(int p) {return (int)1 << p;}
|
||||||
|
template<typename Type> inline int pimin(const Type & f, const Type & s) {return (f > s) ? s : f;}
|
||||||
|
template<typename Type> inline int pimax(const Type & f, const Type & s) {return (f < s) ? s : f;}
|
||||||
|
|
||||||
|
/// Vector
|
||||||
|
|
||||||
|
#define PIMV_FOR(v, s) for (uint v = s; v < Size; ++v)
|
||||||
|
|
||||||
|
template<uint Size, typename Type = double>
|
||||||
|
class PIMathVector {
|
||||||
|
typedef PIMathVector<Size, Type> _CVector;
|
||||||
|
public:
|
||||||
|
PIMathVector() {resize(Size);}
|
||||||
|
PIMathVector(Type fval, ...) {resize(Size); c[0] = fval; va_list vl; va_start(vl, fval); PIMV_FOR(i, 1) c[i] = va_arg(vl, Type); va_end(vl);}
|
||||||
|
|
||||||
|
inline uint size() const {return Size;}
|
||||||
|
inline _CVector & fill(const Type & v) {PIMV_FOR(i, 0) c[i] = v; return *this;}
|
||||||
|
inline _CVector & set(Type fval, ...) {c[0] = fval; va_list vl; va_start(vl, fval); PIMV_FOR(i, 1) c[i] = va_arg(vl, Type); va_end(vl); return *this;}
|
||||||
|
inline _CVector & move(const Type & v) {PIMV_FOR(i, 0) c[i] += v; return *this;}
|
||||||
|
inline Type lengthSqr() const {Type tv(0); PIMV_FOR(i, 0) tv += c[i] * c[i]; return tv;}
|
||||||
|
inline Type length() const {return sqrt(lengthSqr());}
|
||||||
|
inline Type manhattanLength() const {Type tv(0); PIMV_FOR(i, 0) tv += fabs(c[i]); return tv;}
|
||||||
|
inline Type angleCos(const _CVector & v) const {Type tv = v.length() * length(); return (tv == Type(0) ? Type(0) : ((*this) ^ v) / tv);}
|
||||||
|
inline Type angleSin(const _CVector & v) const {Type tv = angleCos(v); return sqrt(Type(1) - tv * tv);}
|
||||||
|
inline Type angleRad(const _CVector & v) const {return acos(angleCos(v));}
|
||||||
|
inline Type angleDeg(const _CVector & v) const {return acos(angleCos(v)) * rad2deg;}
|
||||||
|
inline _CVector projection(const _CVector & v) {Type tv = v.length(); return (tv == Type(0) ? _CVector() : v * (((*this) ^ v) / tv));}
|
||||||
|
inline void normalize() {Type tv = length(); if (tv == Type(1)) return; PIMV_FOR(i, 0) c[i] /= tv;}
|
||||||
|
inline bool isNull() const {PIMV_FOR(i, 0) if (c[i] != Type(0)) return false; return true;}
|
||||||
|
inline bool isOrtho(const _CVector & v) const {return ((*this) ^ v) == Type(0);}
|
||||||
|
|
||||||
|
inline Type & at(uint index) {return c[index];}
|
||||||
|
inline Type at(uint index) const {return c[index];}
|
||||||
|
inline Type & operator [](uint index) {return c[index];}
|
||||||
|
inline Type operator [](uint index) const {return c[index];}
|
||||||
|
inline void operator =(const _CVector & v) {c = v.c;}
|
||||||
|
inline bool operator ==(const _CVector & v) const {PIMV_FOR(i, 0) if (c[i] != v[i]) return false; return true;}
|
||||||
|
inline bool operator !=(const _CVector & v) const {return !(*this == c);}
|
||||||
|
inline void operator +=(const _CVector & v) {PIMV_FOR(i, 0) c[i] += v[i];}
|
||||||
|
inline void operator -=(const _CVector & v) {PIMV_FOR(i, 0) c[i] -= v[i];}
|
||||||
|
inline void operator *=(const Type & v) {PIMV_FOR(i, 0) c[i] *= v;}
|
||||||
|
inline void operator /=(const Type & v) {PIMV_FOR(i, 0) c[i] /= v;}
|
||||||
|
inline _CVector operator -() {_CVector tv; PIMV_FOR(i, 0) tv[i] = -c[i]; return tv;}
|
||||||
|
inline _CVector operator +(const _CVector & v) {_CVector tv = _CVector(*this); PIMV_FOR(i, 0) tv[i] += v[i]; return tv;}
|
||||||
|
inline _CVector operator -(const _CVector & v) {_CVector tv = _CVector(*this); PIMV_FOR(i, 0) tv[i] -= v[i]; return tv;}
|
||||||
|
inline _CVector operator *(const Type & v) {_CVector tv = _CVector(*this); PIMV_FOR(i, 0) tv[i] *= v; return tv;}
|
||||||
|
inline _CVector operator /(const Type & v) {_CVector tv = _CVector(*this); PIMV_FOR(i, 0) tv[i] /= v; return tv;}
|
||||||
|
inline Type operator ^(const _CVector & v) const {Type tv(0); PIMV_FOR(i, 0) tv += c[i] * v[i]; return tv;}
|
||||||
|
|
||||||
|
private:
|
||||||
|
inline void resize(uint size, const Type & new_value = Type()) {c.resize(size, new_value);}
|
||||||
|
PIVector<Type> c;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
template<uint Size, typename Type>
|
||||||
|
inline std::ostream & operator <<(std::ostream & s, const PIMathVector<Size, Type> & v) {s << '{'; PIMV_FOR(i, 0) {s << v[i]; if (i < Size - 1) s << ", ";} s << '}'; return s;}
|
||||||
|
|
||||||
|
typedef PIMathVector<2u, int> PIMathVector2i;
|
||||||
|
typedef PIMathVector<3u, int> PIMathVector3i;
|
||||||
|
typedef PIMathVector<4u, int> PIMathVector4i;
|
||||||
|
typedef PIMathVector<2u, double> PIMathVector2d;
|
||||||
|
typedef PIMathVector<3u, double> PIMathVector3d;
|
||||||
|
typedef PIMathVector<4u, double> PIMathVector4d;
|
||||||
|
|
||||||
|
/// Matrix
|
||||||
|
|
||||||
|
#define PIMM_FOR(c, r) for (uint c = 0; c < Cols; ++c) { for (uint r = 0; r < Rows; ++r) {
|
||||||
|
#define PIMM_FOR_WB(c, r) for (uint c = 0; c < Cols; ++c) for (uint r = 0; r < Rows; ++r) // without brakes
|
||||||
|
#define PIMM_FOR_I(c, r) for (uint r = 0; r < Rows; ++r) { for (uint c = 0; c < Cols; ++c) {
|
||||||
|
#define PIMM_FOR_I_WB(c, r) for (uint r = 0; r < Rows; ++r) for (uint c = 0; c < Cols; ++c) // without brakes
|
||||||
|
#define PIMM_FOR_C(v) for (uint v = 0; v < Cols; ++v)
|
||||||
|
#define PIMM_FOR_R(v) for (uint v = 0; v < Rows; ++v)
|
||||||
|
|
||||||
|
template<uint Cols, uint Rows = Cols, typename Type = double>
|
||||||
|
class PIMathMatrix {
|
||||||
|
typedef PIMathMatrix<Cols, Rows, Type> _CMatrix;
|
||||||
|
typedef PIMathMatrix<Rows, Cols, Type> _CMatrixI;
|
||||||
|
typedef PIMathVector<Rows, Type> _CMCol;
|
||||||
|
typedef PIMathVector<Cols, Type> _CMRow;
|
||||||
|
public:
|
||||||
|
PIMathMatrix() {resize(Cols, Rows);}
|
||||||
|
PIMathMatrix(Type fval, ...) {resize(Cols, Rows); va_list vl; va_start(vl, fval); PIMM_FOR_I_WB(c, r) m[c][r] = (r + c == 0 ? fval : va_arg(vl, Type)); va_end(vl);}
|
||||||
|
|
||||||
|
inline uint cols() const {return Cols;}
|
||||||
|
inline uint rows() const {return Rows;}
|
||||||
|
inline _CMCol col(uint index) {_CMCol tv; PIMM_FOR_R(i) tv[i] = m[index][i]; return tv;}
|
||||||
|
inline _CMRow row(uint index) {_CMRow tv; PIMM_FOR_C(i) tv[i] = m[i][index]; return tv;}
|
||||||
|
inline _CMatrix & setCol(uint index, const _CMCol & v) {PIMM_FOR_R(i) m[index][i] = v[i]; return *this;}
|
||||||
|
inline _CMatrix & setRow(uint index, const _CMRow & v) {PIMM_FOR_C(i) m[i][index] = v[i]; return *this;}
|
||||||
|
inline _CMatrix & fill(const Type & v) {PIMM_FOR_WB(c, r) m[c][r] = v; return *this;}
|
||||||
|
//inline _CMatrix & set(Type fval, ...) {m[0] = fval; va_list vl; va_start(vl, fval); PIMV_FOR(i, 1) m[i] = va_arg(vl, Type); va_end(vl); return *this;}
|
||||||
|
//inline void normalize() {Type tv = length(); if (tv == Type(1)) return; PIMV_FOR(i, 0) m[i] /= tv;}
|
||||||
|
inline bool isSquare() const {return cols() == rows();}
|
||||||
|
inline bool isIdentity() const {PIMM_FOR_WB(c, r) if ((c == r) ? m[c][r] != Type(1) : m[c][r] != Type(0)) return false; return true;}
|
||||||
|
inline bool isNull() const {PIMM_FOR_WB(c, r) if (m[c][r] != Type(0)) return false; return true;}
|
||||||
|
|
||||||
|
inline Type & at(uint col, uint row) {return m[col][row];}
|
||||||
|
inline Type at(uint col, uint row) const {return m[col][row];}
|
||||||
|
inline PIVector<Type> & operator [](uint col) {return m[col];}
|
||||||
|
inline PIVector<Type> operator [](uint col) const {return m[col];}
|
||||||
|
inline void operator =(const _CMatrix & sm) {m = sm.m;}
|
||||||
|
inline bool operator ==(const _CMatrix & sm) const {PIMM_FOR_WB(c, r) if (m[c][r] != sm.m[c][r]) return false; return true;}
|
||||||
|
inline bool operator !=(const _CMatrix & sm) const {return !(*this == sm);}
|
||||||
|
inline void operator +=(const _CMatrix & sm) {PIMM_FOR_WB(c, r) m[c][r] += sm.m[c][r];}
|
||||||
|
inline void operator -=(const _CMatrix & sm) {PIMM_FOR_WB(c, r) m[c][r] -= sm.m[c][r];}
|
||||||
|
inline void operator *=(const Type & v) {PIMM_FOR_WB(c, r) m[c][r] *= v;}
|
||||||
|
inline void operator /=(const Type & v) {PIMM_FOR_WB(c, r) m[c][r] /= v;}
|
||||||
|
inline _CMatrix operator -() {_CMatrix tm; PIMM_FOR_WB(c, r) tm.m[c][r] = -m[c][r]; return tm;}
|
||||||
|
inline _CMatrix operator +(const _CMatrix & sm) {_CMatrix tm = _CMatrix(*this); PIMM_FOR_WB(c, r) tm.m[c][r] += sm.m[c][r]; return tm;}
|
||||||
|
inline _CMatrix operator -(const _CMatrix & sm) {_CMatrix tm = _CMatrix(*this); PIMM_FOR_WB(c, r) tm.m[c][r] -= sm.m[c][r]; return tm;}
|
||||||
|
inline _CMatrix operator *(const Type & v) {_CMatrix tm = _CMatrix(*this); PIMM_FOR_WB(c, r) tm.m[c][r] *= v; return tm;}
|
||||||
|
inline _CMatrix operator /(const Type & v) {_CMatrix tm = _CMatrix(*this); PIMM_FOR_WB(c, r) tm.m[c][r] /= v; return tm;}
|
||||||
|
|
||||||
|
private:
|
||||||
|
inline void resize(uint cols, uint rows, const Type & new_value = Type()) {m.resize(cols); PIMM_FOR_C(i) m[i].resize(rows, new_value);}
|
||||||
|
PIVector<PIVector<Type> > m;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
template<uint Cols, uint Rows, typename Type>
|
||||||
|
inline std::ostream & operator <<(std::ostream & s, const PIMathMatrix<Cols, Rows, Type> & m) {s << '{'; PIMM_FOR_I(c, r) s << m[c][r]; if (c < Cols - 1 || r < Rows - 1) s << ", ";} if (r < Rows - 1) s << endl;} s << '}'; return s;}
|
||||||
|
|
||||||
|
typedef PIMathMatrix<2u, 2u, int> PIMathMatrix22i;
|
||||||
|
typedef PIMathMatrix<3u, 3u, int> PIMathMatrix33i;
|
||||||
|
typedef PIMathMatrix<4u, 4u, int> PIMathMatrix44i;
|
||||||
|
typedef PIMathMatrix<2u, 2u, double> PIMathMatrix22d;
|
||||||
|
typedef PIMathMatrix<3u, 3u, double> PIMathMatrix33d;
|
||||||
|
typedef PIMathMatrix<4u, 4u, double> PIMathMatrix44d;
|
||||||
|
|
||||||
|
#undef PIMV_FOR
|
||||||
|
#undef PIMM_FOR
|
||||||
|
#undef PIMM_FOR_WB
|
||||||
|
|
||||||
|
#endif // PIMathATH_H
|
||||||
2
pip.h
2
pip.h
@@ -1,4 +1,6 @@
|
|||||||
#include "pitimer.h"
|
#include "pitimer.h"
|
||||||
#include "pivariable.h"
|
#include "pivariable.h"
|
||||||
#include "piconsole.h"
|
#include "piconsole.h"
|
||||||
|
#include "pigeometry.h"
|
||||||
|
#include "pimath.h"
|
||||||
#include "piprotocol.h"
|
#include "piprotocol.h"
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ void PISerial::end() {
|
|||||||
|
|
||||||
bool PISerial::init() {
|
bool PISerial::init() {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
hCom = CreateFile(devName.stdString().c_str(), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, FILE_ATTRIBUTE_SYSTEM, 0);
|
hCom = CreateFileA(devName.stdString().c_str(), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, FILE_ATTRIBUTE_SYSTEM, 0);
|
||||||
if(hCom == INVALID_HANDLE_VALUE) {
|
if(hCom == INVALID_HANDLE_VALUE) {
|
||||||
cout << "[PISerial] Unable to open " << devName << endl;
|
cout << "[PISerial] Unable to open " << devName << endl;
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -71,11 +71,11 @@ PIString & PIString::cutMid(const int start, const int len) {
|
|||||||
s = 0;
|
s = 0;
|
||||||
}
|
}
|
||||||
if (l < 0)
|
if (l < 0)
|
||||||
erase(begin() + s, end());
|
remove(s, size() - s);
|
||||||
else {
|
else {
|
||||||
if (l > length() - s)
|
if (l > length() - s)
|
||||||
l = length() - s;
|
l = length() - s;
|
||||||
erase(begin() + s, begin() + s + l);
|
remove(s, s + l);
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include "piincludes.h"
|
#include "piincludes.h"
|
||||||
|
|
||||||
class PIString: public vector<char>
|
class PIString: public PIVector<char>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PIString() {;}
|
PIString() {;}
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ void PIVariable::writeVariable(char * dest) {
|
|||||||
|
|
||||||
|
|
||||||
void PIStruct::parseFile(const PIString & file) {
|
void PIStruct::parseFile(const PIString & file) {
|
||||||
PIConfig conf(file);
|
PIConfig conf(file, PIFile::Read);
|
||||||
PIVariable var;
|
PIVariable var;
|
||||||
PIString ts;
|
PIString ts;
|
||||||
uint sz = 0;
|
uint sz = 0;
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
uint size_;
|
uint size_;
|
||||||
PIString name_;
|
PIString name_;
|
||||||
vector<PIVariable> vars;
|
PIVector<PIVariable> vars;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user