Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Octave client-api #98

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,33 @@ compiler:

before_install:
- if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-add-repository --yes ppa:ubuntu-sdk-team/ppa; fi
- if [ $TRAVIS_OS_NAME == linux ]; then sudo add-apt-repository --yes ppa:octave/stable; fi
- if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get update -qq > output; fi
- if [ $TRAVIS_OS_NAME == osx ]; then brew update && brew install qt5 && export PATH=/usr/local/opt/qt5/bin:$PATH; fi

install:
- if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get install -qq qt5-default libqt5svg5-dev > output; fi
# 32 bit compatibility (since CMake is a 32 bit bin)
- if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get install -qq libc6:i386; fi
# Install Octave for test of client API
- if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get install -qq octave liboctave-dev libmpfr-dev; fi
# Install CMake bin (32 bit)
- if [ $TRAVIS_OS_NAME == linux ]; then wget --no-check-certificate -P /tmp http://www.cmake.org/files/v2.8/cmake-2.8.12.1-Linux-i386.sh; fi
- if [ $TRAVIS_OS_NAME == linux ]; then chmod +rx /tmp/cmake-2.8.12.1-Linux-i386.sh; fi
- if [ $TRAVIS_OS_NAME == linux ]; then sudo sh /tmp/cmake-2.8.12.1-Linux-i386.sh --prefix=/usr/local/ --exclude-subdir --skip-license; fi

before_script:
- cd viewer
- mkdir build
- cd build
- mkdir -p viewer/build
- cmake --version
- cmake ../
- (cd viewer/build && cmake ..)

script: make
script:
- make -C viewer/build
- make -C client-api/Octave
- if [ $TRAVIS_OS_NAME == linux ]; then make -C client-api/Octave check; fi

after_success:
- if [ $TRAVIS_OS_NAME == linux ]; then make -C client-api/Octave html; fi

os:
- linux
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The main design goal of VIBes is to be cross-platform, available from different

VIBes consists in two parts:
- the VIBes application that features viewing, annotating and exporting figures
- the VIBes API that enables your program to communicate with the viewer in order to draw figures from C, C++, Python, Matlab...
- the VIBes API that enables your program to communicate with the viewer in order to draw figures from C, C++, Python, Octave, Matlab...

The use of a separate viewer application enables an easy set-up on every system. First, pre-built binaries of the VIBes viewer are provided for Windows, MacOS and Linux platforms (but you are free to build the viewer from sources). Then, the API consists only of a few files that have to be included in your program.

Expand Down
3 changes: 3 additions & 0 deletions client-api/Octave/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.* export-ignore
/Makefile export-ignore

6 changes: 6 additions & 0 deletions client-api/Octave/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
vibes-*.tar.gz
vibes-bundle/**
vibes-html/**
fntests.log
octave-*

711 changes: 711 additions & 0 deletions client-api/Octave/COPYING

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions client-api/Octave/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Name: vibes
Version: %VERSION%
Date: %DATE%
Author: Oliver Heimlich <[email protected]>
Maintainer: ENSTA Bretagne Robotics
Title: Interface to VIBes, Visualizer for Intervals and Boxes
Description: The VIBes API allows one to easily display results (boxes, pavings)
from interval methods.

VIBes consists in two parts: (1) the VIBes application that features viewing,
annotating and exporting figures, and (2) the VIBes API that enables your
program to communicate with the viewer in order to draw figures.

This package integrates the VIBes API into Octave. The VIBes application
is required for operation and must be installed seperately. Data types from
third-party interval arithmetic libraries for Octave are also supported.
Depends: octave (>= 4.0.0)
License: GPL-3.0+, MIT
11 changes: 11 additions & 0 deletions client-api/Octave/INDEX
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
vibes >> VIBes' API for Octave
Connection - Starting and ending VIBes
vibes.beginDrawing
vibes.endDrawing
Figure and view management
vibes.newFigure
vibes.axisAuto
vibes.axisLabels
Drawing and editing functions
vibes.drawBox
vibes.drawLine
174 changes: 174 additions & 0 deletions client-api/Octave/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
SHELL = /bin/sh

## Copyright 2015-2016 Oliver Heimlich
##
## This file is part of VIBes' API for Octave.
##
## VIBes' API for Octave is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## VIBes' API for Octave is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with VIBes' API for Octave.
## If not, see <http://www.gnu.org/licenses/>.

CUT ?= cut
PACKAGE = $(shell grep "^Name: " DESCRIPTION | $(CUT) -f2 -d" ")
VERSION = $(shell grep "^/// \\\\version " ../C++/src/vibes.h | $(CUT) -f3 -d" " | sed -e "s/[^0-9.]//g")
DATE = $(shell date "+%Y-%m-%d")

##
## Release Process
##
## Create a tarball distribution for the Octave package
##

GZIP ?= gzip
RELEASE_TARBALL = $(PACKAGE)-$(VERSION).tar.gz

.PHONY: dist
dist: $(RELEASE_TARBALL)

$(RELEASE_TARBALL): ../../.git/index
@echo "Creating package release ..."
@# The C++ API must be bundled
@rm -rf "$(PACKAGE)-bundle"
@mkdir -p "$(PACKAGE)-bundle"
@git archive --format=tar --prefix="$(PACKAGE)-$(VERSION)/" HEAD | \
(cd "$(PACKAGE)-bundle" && tar xf -)
@(cd ../C++/; git archive --format=tar --prefix="$(PACKAGE)-$(VERSION)/" HEAD src) | \
(cd "$(PACKAGE)-bundle" && tar xf -)
@sed -i -e "s/%VERSION%/$(VERSION)/" "$(PACKAGE)-bundle/$(PACKAGE)-$(VERSION)/DESCRIPTION"
@sed -i -e "s/%DATE%/$(DATE)/" "$(PACKAGE)-bundle/$(PACKAGE)-$(VERSION)/DESCRIPTION"
@(cd "$(PACKAGE)-bundle" && tar czf "../$@" "$(PACKAGE)-$(VERSION)")

##
## Local Install Process
##
## Do a local installation for testing in Octave, this will compile the package
##

OCTAVE ?= octave
MKOCTFILE ?= mkoctfile -Wall
INSTALLED_PACKAGE_DIR = ~/octave/$(PACKAGE)-$(VERSION)
INSTALLED_PACKAGE = $(INSTALLED_PACKAGE_DIR)/packinfo/DESCRIPTION

.PHONY: install
install: $(INSTALLED_PACKAGE)

$(INSTALLED_PACKAGE): $(RELEASE_TARBALL)
@echo "Installing package in GNU Octave ..."
@$(OCTAVE) --no-gui --silent --eval "pkg install $<"

##
## Publishing Process
##
## Also generate package documentation for the release
##

HTML_DIR = $(PACKAGE)-html
HTML_TARBALL = $(HTML_DIR).tar.gz
FORGE_HTML_TARBALL = $(HTML_DIR)-forge.tar.gz

.PHONY: forge-html html release md5
forge-html: $(FORGE_HTML_TARBALL)
html: $(HTML_TARBALL)
release: $(RELEASE_TARBALL) $(FORGE_HTML_TARBALL) $(HTML_TARBALL) md5

$(HTML_TARBALL): $(INSTALLED_PACKAGE)
@echo "Generating HTML documentation for the package (GitHub) ..."
@$(RM) -r "$(HTML_DIR)"
@# Make sure that the generate_html package is present
@$(OCTAVE) --no-gui --silent \
--eval "try;" \
--eval "temp = pkg ('describe', 'generate_html');" \
--eval "catch;" \
--eval "pkg ('install', '-forge', 'generate_html');" \
--eval "end_try_catch;"
@$(OCTAVE) --no-gui --silent \
--eval "pkg load generate_html;" \
--eval "options = get_html_options ('octave');" \
--eval "options.overview_title = 'VIBes Client API for Octave';" \
--eval "options.css = '/sylesheets/style.css';" \
--eval "options.header = '<!DOCTYPE html><html><head><meta http-equiv=\"content-type\" content=\"text/html; charset=%charset\"/><title>VIBes Client API for Octave - %title</title><link rel=\"stylesheet\" href=\"%css\"/><style type=\"text/css\">h3.category {margin-top: 2em}</style></head><body><h1>%title</h1>';" \
--eval "options.footer = '</body></html>';" \
--eval "generate_package_html ('$(PACKAGE)', '$(HTML_DIR)', options)"
@mv "$(HTML_DIR)/$(PACKAGE)" "$(HTML_DIR)/octave-api"
@tar --create --auto-compress --file "$@" "$(HTML_DIR)"

$(FORGE_HTML_TARBALL): $(INSTALLED_PACKAGE)
@echo "Generating HTML documentation for the package (Octave Forge) ..."
@$(RM) -r "$(HTML_DIR)"
@# Make sure that the generate_html package is present
@$(OCTAVE) --no-gui --silent \
--eval "try;" \
--eval "temp = pkg ('describe', 'generate_html');" \
--eval "catch;" \
--eval "pkg ('install', '-forge', 'generate_html');" \
--eval "end_try_catch;"
@$(OCTAVE) --no-gui --silent \
--eval "pkg load generate_html;" \
--eval "options = get_html_options ('octave-forge');" \
--eval "generate_package_html ('$(PACKAGE)', '$(HTML_DIR)', options)"
@tar --create --auto-compress --file "$@" "$(HTML_DIR)"

md5: $(RELEASE_TARBALL) $(HTML_TARBALL) $(FORGE_HTML_TARBALL)
@md5sum $^

##
## Testing Process
##
## Interactive shell with the package installed and loaded /
## Non-interactive processing of integrated unit tests
##

.PHONY: run check
PUBLIC_FUNCTIONS = $(patsubst inst/%.m,%,$(wildcard inst/+vibes/*.m))

run: $(INSTALLED_PACKAGE)
@echo "Run GNU Octave with the development version of the package"
@$(OCTAVE) --no-gui --silent --eval "pkg load $(PACKAGE)" --persist
@echo

check: $(INSTALLED_PACKAGE)
@echo "Testing package in GNU Octave ..."
@# Make sure that the interval package is present, some tests depend on this
@$(OCTAVE) --no-gui --silent \
--eval "try;" \
--eval "temp = pkg ('describe', 'interval');" \
--eval "catch;" \
--eval "pkg ('install', '-forge', 'interval');" \
--eval "end_try_catch;"
@rm -f ~/.vibes.json
@$(OCTAVE) --no-gui --silent \
--eval "pkg load $(PACKAGE);" \
--eval "success = true;" \
--eval "targets = strsplit ('$(PUBLIC_FUNCTIONS)', ' ');" \
--eval "for target = targets;" \
--eval "[n, nmax] = test (target{1}, 'verbose');" \
--eval "success &= (n == nmax);" \
--eval "endfor;" \
--eval "exit (not (success));"
@cat ~/.vibes.json

##
## Cleanup
##

.PHONY: clean

clean:
rm -rf \
$(PACKAGE)-*.tar.gz \
"$(PACKAGE)-bundle" \
"$(HTML_DIR)" \
"$(HTML_TARBALL)" \
"fntests.log" \
octave-*

8 changes: 8 additions & 0 deletions client-api/Octave/NEWS
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
VIBes' Client API for Octave
Summary of important user-visible changes

Version 0.2.0 2016-06-22
========================

• Initial release with compatibility for the Matlab client API
• New function drawBoxes to draw a list of many boxes
37 changes: 37 additions & 0 deletions client-api/Octave/inst/+vibes/axisAuto.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
## Copyright 2015-2016 Oliver Heimlich
##
## This file is part of VIBes' API for Octave.
##
## VIBes' API for Octave is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## VIBes' API for Octave is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with VIBes' API for Octave.
## If not, see <http://www.gnu.org/licenses/>.

## -*- texinfo -*-
## @documentencoding UTF-8
## @deftypefn {Function File} {} vibes.axisAuto ()
## Reset the view box to automatic mode in the VIBes viewer.
## @end deftypefn
function axisAuto ()

if (nargin != 0)
print_usage ();
endif

__vibes__ ('axisAuto');

endfunction

%!test
%! vibes.beginDrawing
%! vibes.axisAuto
%! vibes.endDrawing
45 changes: 45 additions & 0 deletions client-api/Octave/inst/+vibes/axisLabels.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
## Copyright 2015-2016 Oliver Heimlich
##
## This file is part of VIBes' API for Octave.
##
## VIBes' API for Octave is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## VIBes' API for Octave is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with VIBes' API for Octave.
## If not, see <http://www.gnu.org/licenses/>.

## -*- texinfo -*-
## @documentencoding UTF-8
## @deftypefn {Function File} {} vibes.axisLabels (@var{label1}, @var{label2}, @dots{})
## @deftypefnx {Function File} {} vibes.axisLabels (@{@var{label1}, @var{label2}, @dots{}@})
## Set axis labels for the current VIBes figure.
## @end deftypefn
##
## @deftypefn {Function File} {} vibes.axisLabels (@{@var{label1}, @var{label2}, @dots{}@}, @var{figure})
## Set axis labels for given VIBes figure.
## @end deftypefn
function axisLabels (varargin)

if (nargin == 0)
print_usage ();
endif

__vibes__ ('axisLabels', varargin{:});

endfunction

%!shared
%! vibes.beginDrawing
%!test vibes.axisLabels ('x', 'y', 'z')
%!test vibes.axisLabels ({'x', 'y', 'z'})
%!test vibes.axisLabels ({'a', 'b', 'c'}, 'alphabet')
%!shared
%! vibes.endDrawing
Loading