changeset 11691:6e3240fcadb4 octave-forge

interfacing the postscript rendering function through the "render" keyword.
author michelemartone
date Thu, 09 May 2013 14:02:53 +0000
parents e7edce4e5688
children 4f0ae470d973
files main/sparsersb/src/sparsersb.cc
diffstat 1 files changed, 27 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/main/sparsersb/src/sparsersb.cc	Wed May 08 13:41:40 2013 +0000
+++ b/main/sparsersb/src/sparsersb.cc	Thu May 09 14:02:53 2013 +0000
@@ -24,7 +24,6 @@
  * compound_binary_op
  * for thorough testing, see Octave's test/build_sparse_tests.sh
  * introspection functionality (bytes/nnz, or  sparsersb(rsbmat,"inquire: subm") )
- * sparsersb(rsbmat,"autotune")
  * sparsersb(rsbmat,"benchmark")
  * sparsersb(rsbmat,"test")
  * minimize data copies
@@ -175,6 +174,12 @@
 #define RSBOI_RSB_MATRIX_SOLVE(V1,V2) RSBOI_0_ERROR(RSBOI_0_NOTERRMSG)  /* any solution routine shall attached here */
 #endif
 
+#if 1
+extern "C" { rsb_err_t rsb_dump_postscript_from_mtx_t(const struct rsb_mtx_t*mtxAp, rsb_blk_idx_t br, rsb_blk_idx_t bc, int width, int height, rsb_bool_t all_nnz); }
+extern "C" {
+rsb_err_t rsb_dump_postscript_recursion_from_mtx_t(const struct rsb_mtx_t*mtxAp, rsb_blk_idx_t br, rsb_blk_idx_t bc, int width, int height, rsb_flags_t flags, rsb_bool_t want_blocks, rsb_bool_t z_dump , rsb_bool_t want_nonzeros ); }
+#endif
+
 #if RSBOI_WANT_HEAVY_DEBUG
 extern "C" {
 	rsb_bool_t rsb_is_correctly_built_rcsr_matrix(const struct rsb_mtx_t *mtxAp); // forward declaration
@@ -1814,6 +1819,27 @@
 		goto errp;
 	}
 
+#if defined(RSB_LIBRSB_VER) && (RSB_LIBRSB_VER>=10100)
+	if (nargin == 3 && isr 
+ 		&& args(1).is_string() && args(1).string_value()=="render"
+		&& args(2).is_string())
+	{
+		rsb_err_t errval=RSB_ERR_NO_ERROR;
+		const char *rmf=args(2).string_value().c_str();
+		rsb_coo_idx_t pmWidth=512, pmHeight=512;
+
+		if(!osmp || !osmp->mtxAp)
+			goto ret;/* FIXME: error handling missing here */
+
+		errval = rsb_mtx_render(rmf,osmp->mtxAp,pmWidth,pmHeight,RSB_MARF_EPS);
+
+		/* FIXME: serious error handling missing here */
+		if(RSBOI_SOME_ERROR(errval))
+			retval.append(std::string("Error returned from rsb_file_mtx_render()"));
+		goto ret;
+	}
+#endif
+
 	if (nargin == 3 && isr 
  		&& args(1).is_string() && args(1).string_value()=="get"
 		&& args(2).is_string())