Mercurial > octave-nkf
comparison libinterp/octave-value/ov-class.cc @ 17787:175b392e91fe
Use GNU style coding conventions for code in libinterp/
* libinterp/corefcn/Cell.h, libinterp/corefcn/__contourc__.cc,
libinterp/corefcn/__dispatch__.cc, libinterp/corefcn/__lin_interpn__.cc,
libinterp/corefcn/__pchip_deriv__.cc, libinterp/corefcn/__qp__.cc,
libinterp/corefcn/balance.cc, libinterp/corefcn/besselj.cc,
libinterp/corefcn/betainc.cc, libinterp/corefcn/bitfcns.cc,
libinterp/corefcn/bsxfun.cc, libinterp/corefcn/c-file-ptr-stream.cc,
libinterp/corefcn/c-file-ptr-stream.h, libinterp/corefcn/cellfun.cc,
libinterp/corefcn/colloc.cc, libinterp/corefcn/comment-list.h,
libinterp/corefcn/conv2.cc, libinterp/corefcn/daspk.cc,
libinterp/corefcn/dasrt.cc, libinterp/corefcn/dassl.cc,
libinterp/corefcn/data.cc, libinterp/corefcn/debug.cc,
libinterp/corefcn/defaults.cc, libinterp/corefcn/defaults.in.h,
libinterp/corefcn/defun-int.h, libinterp/corefcn/defun.cc,
libinterp/corefcn/det.cc, libinterp/corefcn/dirfns.cc,
libinterp/corefcn/display.cc, libinterp/corefcn/dlmread.cc,
libinterp/corefcn/dot.cc, libinterp/corefcn/dynamic-ld.cc,
libinterp/corefcn/dynamic-ld.h, libinterp/corefcn/eig.cc,
libinterp/corefcn/ellipj.cc, libinterp/corefcn/error.cc,
libinterp/corefcn/error.h, libinterp/corefcn/event-queue.h,
libinterp/corefcn/fft.cc, libinterp/corefcn/fft2.cc, libinterp/corefcn/fftn.cc,
libinterp/corefcn/file-io.cc, libinterp/corefcn/filter.cc,
libinterp/corefcn/find.cc, libinterp/corefcn/gammainc.cc,
libinterp/corefcn/gcd.cc, libinterp/corefcn/getgrent.cc,
libinterp/corefcn/getpwent.cc, libinterp/corefcn/getrusage.cc,
libinterp/corefcn/givens.cc, libinterp/corefcn/gl-render.cc,
libinterp/corefcn/gl2ps-renderer.cc, libinterp/corefcn/gl2ps-renderer.h,
libinterp/corefcn/graphics.cc, libinterp/corefcn/graphics.in.h,
libinterp/corefcn/gripes.cc, libinterp/corefcn/gripes.h,
libinterp/corefcn/help.cc, libinterp/corefcn/hess.cc,
libinterp/corefcn/hex2num.cc, libinterp/corefcn/input.cc,
libinterp/corefcn/input.h, libinterp/corefcn/inv.cc,
libinterp/corefcn/jit-ir.h, libinterp/corefcn/jit-typeinfo.cc,
libinterp/corefcn/jit-typeinfo.h, libinterp/corefcn/jit-util.h,
libinterp/corefcn/kron.cc, libinterp/corefcn/load-path.cc,
libinterp/corefcn/load-path.h, libinterp/corefcn/load-save.cc,
libinterp/corefcn/load-save.h, libinterp/corefcn/lookup.cc,
libinterp/corefcn/ls-ascii-helper.cc, libinterp/corefcn/ls-hdf5.cc,
libinterp/corefcn/ls-hdf5.h, libinterp/corefcn/ls-mat-ascii.cc,
libinterp/corefcn/ls-mat-ascii.h, libinterp/corefcn/ls-mat4.cc,
libinterp/corefcn/ls-mat5.cc, libinterp/corefcn/ls-mat5.h,
libinterp/corefcn/ls-oct-ascii.cc, libinterp/corefcn/lsode.cc,
libinterp/corefcn/lu.cc, libinterp/corefcn/luinc.cc,
libinterp/corefcn/mappers.cc, libinterp/corefcn/matrix_type.cc,
libinterp/corefcn/max.cc, libinterp/corefcn/md5sum.cc,
libinterp/corefcn/mex.cc, libinterp/corefcn/mexproto.h,
libinterp/corefcn/mgorth.cc, libinterp/corefcn/mxarray.in.h,
libinterp/corefcn/nproc.cc, libinterp/corefcn/oct-hist.cc,
libinterp/corefcn/oct-lvalue.h, libinterp/corefcn/oct-map.cc,
libinterp/corefcn/oct-map.h, libinterp/corefcn/oct-obj.h,
libinterp/corefcn/oct-prcstrm.h, libinterp/corefcn/oct-stdstrm.h,
libinterp/corefcn/oct-stream.cc, libinterp/corefcn/oct-stream.h,
libinterp/corefcn/octave-link.cc, libinterp/corefcn/octave-link.h,
libinterp/corefcn/pager.cc, libinterp/corefcn/pinv.cc,
libinterp/corefcn/pr-output.cc, libinterp/corefcn/procstream.h,
libinterp/corefcn/profiler.cc, libinterp/corefcn/pt-jit.cc,
libinterp/corefcn/pt-jit.h, libinterp/corefcn/quad.cc,
libinterp/corefcn/quadcc.cc, libinterp/corefcn/qz.cc,
libinterp/corefcn/rand.cc, libinterp/corefcn/rcond.cc,
libinterp/corefcn/regexp.cc, libinterp/corefcn/schur.cc,
libinterp/corefcn/sighandlers.cc, libinterp/corefcn/sighandlers.h,
libinterp/corefcn/sparse-xdiv.cc, libinterp/corefcn/sparse-xdiv.h,
libinterp/corefcn/sparse-xpow.cc, libinterp/corefcn/sparse.cc,
libinterp/corefcn/spparms.cc, libinterp/corefcn/sqrtm.cc,
libinterp/corefcn/str2double.cc, libinterp/corefcn/strfind.cc,
libinterp/corefcn/strfns.cc, libinterp/corefcn/sub2ind.cc,
libinterp/corefcn/svd.cc, libinterp/corefcn/syl.cc,
libinterp/corefcn/symtab.cc, libinterp/corefcn/symtab.h,
libinterp/corefcn/syscalls.cc, libinterp/corefcn/sysdep.cc,
libinterp/corefcn/sysdep.h, libinterp/corefcn/time.cc,
libinterp/corefcn/toplev.cc, libinterp/corefcn/toplev.h,
libinterp/corefcn/tril.cc, libinterp/corefcn/txt-eng-ft.cc,
libinterp/corefcn/txt-eng-ft.h, libinterp/corefcn/txt-eng.h,
libinterp/corefcn/typecast.cc, libinterp/corefcn/urlwrite.cc,
libinterp/corefcn/utils.cc, libinterp/corefcn/variables.cc,
libinterp/corefcn/variables.h, libinterp/corefcn/xdiv.cc,
libinterp/corefcn/xdiv.h, libinterp/corefcn/xnorm.h, libinterp/corefcn/xpow.cc,
libinterp/corefcn/xpow.h, libinterp/corefcn/zfstream.cc,
libinterp/corefcn/zfstream.h, libinterp/dldfcn/__delaunayn__.cc,
libinterp/dldfcn/__dsearchn__.cc, libinterp/dldfcn/__eigs__.cc,
libinterp/dldfcn/__fltk_uigetfile__.cc, libinterp/dldfcn/__glpk__.cc,
libinterp/dldfcn/__init_fltk__.cc, libinterp/dldfcn/__init_gnuplot__.cc,
libinterp/dldfcn/__magick_read__.cc, libinterp/dldfcn/__voronoi__.cc,
libinterp/dldfcn/amd.cc, libinterp/dldfcn/ccolamd.cc, libinterp/dldfcn/chol.cc,
libinterp/dldfcn/colamd.cc, libinterp/dldfcn/convhulln.cc,
libinterp/dldfcn/dmperm.cc, libinterp/dldfcn/fftw.cc, libinterp/dldfcn/qr.cc,
libinterp/dldfcn/symbfact.cc, libinterp/dldfcn/symrcm.cc,
libinterp/dldfcn/tsearch.cc, libinterp/octave-value/ov-base-diag.cc,
libinterp/octave-value/ov-base-diag.h, libinterp/octave-value/ov-base-int.cc,
libinterp/octave-value/ov-base-int.h, libinterp/octave-value/ov-base-mat.h,
libinterp/octave-value/ov-base-scalar.cc,
libinterp/octave-value/ov-base-scalar.h,
libinterp/octave-value/ov-base-sparse.cc,
libinterp/octave-value/ov-base-sparse.h, libinterp/octave-value/ov-base.cc,
libinterp/octave-value/ov-base.h, libinterp/octave-value/ov-bool-mat.cc,
libinterp/octave-value/ov-bool-mat.h, libinterp/octave-value/ov-bool-sparse.cc,
libinterp/octave-value/ov-bool-sparse.h, libinterp/octave-value/ov-bool.cc,
libinterp/octave-value/ov-bool.h, libinterp/octave-value/ov-builtin.cc,
libinterp/octave-value/ov-builtin.h, libinterp/octave-value/ov-cell.cc,
libinterp/octave-value/ov-cell.h, libinterp/octave-value/ov-ch-mat.cc,
libinterp/octave-value/ov-ch-mat.h, libinterp/octave-value/ov-class.cc,
libinterp/octave-value/ov-class.h, libinterp/octave-value/ov-colon.h,
libinterp/octave-value/ov-complex.cc, libinterp/octave-value/ov-complex.h,
libinterp/octave-value/ov-cx-diag.cc, libinterp/octave-value/ov-cx-diag.h,
libinterp/octave-value/ov-cx-mat.cc, libinterp/octave-value/ov-cx-mat.h,
libinterp/octave-value/ov-cx-sparse.cc, libinterp/octave-value/ov-cx-sparse.h,
libinterp/octave-value/ov-dld-fcn.h, libinterp/octave-value/ov-fcn-handle.cc,
libinterp/octave-value/ov-fcn-handle.h,
libinterp/octave-value/ov-fcn-inline.cc,
libinterp/octave-value/ov-fcn-inline.h, libinterp/octave-value/ov-fcn.h,
libinterp/octave-value/ov-float.cc, libinterp/octave-value/ov-float.h,
libinterp/octave-value/ov-flt-complex.cc,
libinterp/octave-value/ov-flt-complex.h,
libinterp/octave-value/ov-flt-cx-diag.cc,
libinterp/octave-value/ov-flt-cx-diag.h,
libinterp/octave-value/ov-flt-cx-mat.cc,
libinterp/octave-value/ov-flt-cx-mat.h,
libinterp/octave-value/ov-flt-re-diag.cc,
libinterp/octave-value/ov-flt-re-diag.h,
libinterp/octave-value/ov-flt-re-mat.cc,
libinterp/octave-value/ov-flt-re-mat.h, libinterp/octave-value/ov-int16.cc,
libinterp/octave-value/ov-int32.cc, libinterp/octave-value/ov-int64.cc,
libinterp/octave-value/ov-int8.cc, libinterp/octave-value/ov-intx.h,
libinterp/octave-value/ov-java.cc, libinterp/octave-value/ov-lazy-idx.h,
libinterp/octave-value/ov-mex-fcn.cc, libinterp/octave-value/ov-mex-fcn.h,
libinterp/octave-value/ov-null-mat.cc, libinterp/octave-value/ov-null-mat.h,
libinterp/octave-value/ov-oncleanup.cc, libinterp/octave-value/ov-perm.cc,
libinterp/octave-value/ov-perm.h, libinterp/octave-value/ov-range.cc,
libinterp/octave-value/ov-range.h, libinterp/octave-value/ov-re-diag.cc,
libinterp/octave-value/ov-re-diag.h, libinterp/octave-value/ov-re-mat.cc,
libinterp/octave-value/ov-re-mat.h, libinterp/octave-value/ov-re-sparse.cc,
libinterp/octave-value/ov-re-sparse.h, libinterp/octave-value/ov-scalar.cc,
libinterp/octave-value/ov-scalar.h, libinterp/octave-value/ov-str-mat.cc,
libinterp/octave-value/ov-str-mat.h, libinterp/octave-value/ov-struct.cc,
libinterp/octave-value/ov-struct.h, libinterp/octave-value/ov-type-conv.h,
libinterp/octave-value/ov-typeinfo.cc, libinterp/octave-value/ov-typeinfo.h,
libinterp/octave-value/ov-uint16.cc, libinterp/octave-value/ov-uint32.cc,
libinterp/octave-value/ov-uint64.cc, libinterp/octave-value/ov-uint8.cc,
libinterp/octave-value/ov-usr-fcn.cc, libinterp/octave-value/ov-usr-fcn.h,
libinterp/octave-value/ov.cc, libinterp/octave-value/ov.h, libinterp/octave.cc,
libinterp/operators/op-b-bm.cc, libinterp/operators/op-b-sbm.cc,
libinterp/operators/op-bm-b.cc, libinterp/operators/op-bm-bm.cc,
libinterp/operators/op-cdm-cdm.cc, libinterp/operators/op-chm.cc,
libinterp/operators/op-class.cc, libinterp/operators/op-cm-cm.cc,
libinterp/operators/op-cm-cs.cc, libinterp/operators/op-cm-s.cc,
libinterp/operators/op-cm-scm.cc, libinterp/operators/op-cm-sm.cc,
libinterp/operators/op-cs-cm.cc, libinterp/operators/op-cs-cs.cc,
libinterp/operators/op-cs-scm.cc, libinterp/operators/op-cs-sm.cc,
libinterp/operators/op-dm-dm.cc, libinterp/operators/op-dm-scm.cc,
libinterp/operators/op-double-conv.cc, libinterp/operators/op-fcdm-fcdm.cc,
libinterp/operators/op-fcm-fcm.cc, libinterp/operators/op-fcm-fcs.cc,
libinterp/operators/op-fcm-fm.cc, libinterp/operators/op-fcm-fs.cc,
libinterp/operators/op-fcs-fcm.cc, libinterp/operators/op-fcs-fcs.cc,
libinterp/operators/op-fcs-fm.cc, libinterp/operators/op-fcs-fs.cc,
libinterp/operators/op-fdm-fdm.cc, libinterp/operators/op-float-conv.cc,
libinterp/operators/op-fm-fcm.cc, libinterp/operators/op-fm-fcs.cc,
libinterp/operators/op-fm-fm.cc, libinterp/operators/op-fm-fs.cc,
libinterp/operators/op-fs-fcm.cc, libinterp/operators/op-fs-fcs.cc,
libinterp/operators/op-fs-fm.cc, libinterp/operators/op-fs-fs.cc,
libinterp/operators/op-m-cm.cc, libinterp/operators/op-m-cs.cc,
libinterp/operators/op-m-m.cc, libinterp/operators/op-m-s.cc,
libinterp/operators/op-m-scm.cc, libinterp/operators/op-m-sm.cc,
libinterp/operators/op-pm-scm.cc, libinterp/operators/op-range.cc,
libinterp/operators/op-s-cm.cc, libinterp/operators/op-s-cs.cc,
libinterp/operators/op-s-scm.cc, libinterp/operators/op-sbm-b.cc,
libinterp/operators/op-sbm-bm.cc, libinterp/operators/op-sbm-sbm.cc,
libinterp/operators/op-scm-cm.cc, libinterp/operators/op-scm-cs.cc,
libinterp/operators/op-scm-m.cc, libinterp/operators/op-scm-s.cc,
libinterp/operators/op-scm-scm.cc, libinterp/operators/op-scm-sm.cc,
libinterp/operators/op-sm-cm.cc, libinterp/operators/op-sm-m.cc,
libinterp/operators/op-sm-s.cc, libinterp/operators/op-sm-scm.cc,
libinterp/operators/op-sm-sm.cc, libinterp/operators/op-str-m.cc,
libinterp/operators/op-str-s.cc, libinterp/operators/op-str-str.cc,
libinterp/operators/ops.h, libinterp/parse-tree/lex.h,
libinterp/parse-tree/parse.h, libinterp/parse-tree/pt-arg-list.cc,
libinterp/parse-tree/pt-arg-list.h, libinterp/parse-tree/pt-assign.cc,
libinterp/parse-tree/pt-assign.h, libinterp/parse-tree/pt-binop.cc,
libinterp/parse-tree/pt-binop.h, libinterp/parse-tree/pt-bp.h,
libinterp/parse-tree/pt-cbinop.cc, libinterp/parse-tree/pt-check.cc,
libinterp/parse-tree/pt-colon.cc, libinterp/parse-tree/pt-colon.h,
libinterp/parse-tree/pt-const.cc, libinterp/parse-tree/pt-decl.cc,
libinterp/parse-tree/pt-decl.h, libinterp/parse-tree/pt-eval.cc,
libinterp/parse-tree/pt-except.h, libinterp/parse-tree/pt-exp.h,
libinterp/parse-tree/pt-fcn-handle.cc, libinterp/parse-tree/pt-id.cc,
libinterp/parse-tree/pt-id.h, libinterp/parse-tree/pt-idx.cc,
libinterp/parse-tree/pt-idx.h, libinterp/parse-tree/pt-loop.h,
libinterp/parse-tree/pt-mat.cc, libinterp/parse-tree/pt-misc.cc,
libinterp/parse-tree/pt-misc.h, libinterp/parse-tree/pt-pr-code.cc,
libinterp/parse-tree/pt-select.h, libinterp/parse-tree/pt-stmt.h,
libinterp/parse-tree/token.h, libinterp/version.cc:
Use GNU style coding conventions for code in libinterp/
author | Rik <rik@octave.org> |
---|---|
date | Mon, 28 Oct 2013 19:51:46 -0700 |
parents | d63878346099 |
children | 2627aeca5032 bd9d34f28b0f |
comparison
equal
deleted
inserted
replaced
17786:34d9812a943b | 17787:175b392e91fe |
---|---|
65 | 65 |
66 void | 66 void |
67 octave_class::register_type (void) | 67 octave_class::register_type (void) |
68 { | 68 { |
69 t_id = octave_value_typeinfo::register_type | 69 t_id = octave_value_typeinfo::register_type |
70 (octave_class::t_name, "<unknown>", octave_value (new octave_class ())); | 70 (octave_class::t_name, "<unknown>", |
71 octave_value (new octave_class ())); | |
71 } | 72 } |
72 | 73 |
73 octave_class::octave_class (const octave_map& m, const std::string& id, | 74 octave_class::octave_class (const octave_map& m, const std::string& id, |
74 const octave_value_list& parents) | 75 const octave_value_list& parents) |
75 : octave_base_value (), map (m), c_name (id), obsolete_copies (0) | 76 : octave_base_value (), map (m), c_name (id), obsolete_copies (0) |
171 map.assign (pcnm, pcell); | 172 map.assign (pcnm, pcell); |
172 } | 173 } |
173 | 174 |
174 else if (nel == p_nel) | 175 else if (nel == p_nel) |
175 { | 176 { |
176 // FIXME -- is there a better way to do this? | 177 // FIXME: is there a better way to do this? |
177 | 178 |
178 // The parent class object has the same number of | 179 // The parent class object has the same number of |
179 // elements as the map we are using to create the | 180 // elements as the map we are using to create the |
180 // new object, so distribute those elements to | 181 // new object, so distribute those elements to |
181 // each element of the new object by first | 182 // each element of the new object by first |
400 static bool | 401 static bool |
401 called_from_builtin (void) | 402 called_from_builtin (void) |
402 { | 403 { |
403 octave_function *fcn = octave_call_stack::caller (); | 404 octave_function *fcn = octave_call_stack::caller (); |
404 | 405 |
405 // FIXME -- we probably need a better check here, or some other | 406 // FIXME: we probably need a better check here, or some other |
406 // mechanism to avoid overloaded functions when builtin is used. | 407 // mechanism to avoid overloaded functions when builtin is used. |
407 // For example, what if someone overloads the builtin function? | 408 // For example, what if someone overloads the builtin function? |
408 // Also, are there other places where using builtin is not properly | 409 // Also, are there other places where using builtin is not properly |
409 // avoiding dispatch? | 410 // avoiding dispatch? |
410 | 411 |
424 { | 425 { |
425 count++; | 426 count++; |
426 octave_value_list args (1, octave_value (this)); | 427 octave_value_list args (1, octave_value (this)); |
427 | 428 |
428 octave_value_list lv = feval (meth.function_value (), args, 1); | 429 octave_value_list lv = feval (meth.function_value (), args, 1); |
429 if (lv.length () > 0 && lv(0).is_matrix_type () && lv(0).dims ().is_vector ()) | 430 if (lv.length () > 0 |
431 && lv(0).is_matrix_type () && lv(0).dims ().is_vector ()) | |
430 retval = lv(0).matrix_value (); | 432 retval = lv(0).matrix_value (); |
431 else | 433 else |
432 error ("@%s/size: invalid return value", class_name ().c_str ()); | 434 error ("@%s/size: invalid return value", class_name ().c_str ()); |
433 } | 435 } |
434 else | 436 else |
486 { | 488 { |
487 octave_value_list retval; | 489 octave_value_list retval; |
488 | 490 |
489 if (in_class_method () || called_from_builtin ()) | 491 if (in_class_method () || called_from_builtin ()) |
490 { | 492 { |
491 // FIXME -- this block of code is the same as the body of | 493 // FIXME: this block of code is the same as the body of |
492 // octave_struct::subsref. Maybe it could be shared instead of | 494 // octave_struct::subsref. Maybe it could be shared instead of |
493 // duplicated. | 495 // duplicated. |
494 | 496 |
495 int skip = 1; | 497 int skip = 1; |
496 | 498 |
507 | 509 |
508 if (! error_state) | 510 if (! error_state) |
509 { | 511 { |
510 Cell t = tmp.index (idx.front ()); | 512 Cell t = tmp.index (idx.front ()); |
511 | 513 |
512 retval(0) = (t.length () == 1) ? t(0) : octave_value (t, true); | 514 retval(0) = (t.length () == 1) ? t(0) |
515 : octave_value (t, true); | |
513 | 516 |
514 // We handled two index elements, so tell | 517 // We handled two index elements, so tell |
515 // next_subsref to skip both of them. | 518 // next_subsref to skip both of them. |
516 | 519 |
517 skip++; | 520 skip++; |
540 | 543 |
541 default: | 544 default: |
542 panic_impossible (); | 545 panic_impossible (); |
543 } | 546 } |
544 | 547 |
545 // FIXME -- perhaps there should be an | 548 // FIXME: perhaps there should be an |
546 // octave_value_list::next_subsref member function? See also | 549 // octave_value_list::next_subsref member function? See also |
547 // octave_user_function::subsref. | 550 // octave_user_function::subsref. |
548 | 551 |
549 if (idx.size () > 1) | 552 if (idx.size () > 1) |
550 retval = retval(0).next_subsref (nargout, type, idx, skip); | 553 retval = retval(0).next_subsref (nargout, type, idx, skip); |
702 tmp = feval (meth.function_value (), args); | 705 tmp = feval (meth.function_value (), args); |
703 } | 706 } |
704 else | 707 else |
705 tmp = feval (meth.function_value (), args); | 708 tmp = feval (meth.function_value (), args); |
706 | 709 |
707 // FIXME -- should the subsasgn method be able to return | 710 // FIXME: should the subsasgn method be able to return |
708 // more than one value? | 711 // more than one value? |
709 | 712 |
710 if (tmp.length () > 1) | 713 if (tmp.length () > 1) |
711 error ("expecting single return value from @%s/subsasgn", | 714 error ("expecting single return value from @%s/subsasgn", |
712 class_name ().c_str ()); | 715 class_name ().c_str ()); |
742 error ("malformed class"); | 745 error ("malformed class"); |
743 | 746 |
744 return retval; | 747 return retval; |
745 } | 748 } |
746 | 749 |
747 // FIXME -- this block of code is the same as the body of | 750 // FIXME: this block of code is the same as the body of |
748 // octave_struct::subsasgn. Maybe it could be shared instead of | 751 // octave_struct::subsasgn. Maybe it could be shared instead of |
749 // duplicated. | 752 // duplicated. |
750 | 753 |
751 int n = type.length (); | 754 int n = type.length (); |
752 | 755 |
840 { | 843 { |
841 tmp = octave_value::empty_conv (next_type, rhs); | 844 tmp = octave_value::empty_conv (next_type, rhs); |
842 tmp.make_unique (); // probably a no-op. | 845 tmp.make_unique (); // probably a no-op. |
843 } | 846 } |
844 else | 847 else |
845 // optimization: ignore the copy still stored inside our map. | 848 // optimization: ignore copy still stored inside our map. |
846 tmp.make_unique (1); | 849 tmp.make_unique (1); |
847 | 850 |
848 if (! error_state) | 851 if (! error_state) |
849 t_rhs = tmp.subsasgn (next_type, next_idx, rhs); | 852 t_rhs = tmp.subsasgn (next_type, next_idx, rhs); |
850 } | 853 } |
1489 return true; | 1492 return true; |
1490 } | 1493 } |
1491 | 1494 |
1492 bool | 1495 bool |
1493 octave_class::load_binary (std::istream& is, bool swap, | 1496 octave_class::load_binary (std::istream& is, bool swap, |
1494 oct_mach_info::float_format fmt) | 1497 oct_mach_info::float_format fmt) |
1495 { | 1498 { |
1496 bool success = true; | 1499 bool success = true; |
1497 | 1500 |
1498 int32_t classname_len; | 1501 int32_t classname_len; |
1499 | 1502 |
1615 #else | 1618 #else |
1616 class_hid = H5Dcreate (group_hid, "classname", type_hid, space_hid, | 1619 class_hid = H5Dcreate (group_hid, "classname", type_hid, space_hid, |
1617 H5P_DEFAULT); | 1620 H5P_DEFAULT); |
1618 #endif | 1621 #endif |
1619 if (class_hid < 0 || H5Dwrite (class_hid, type_hid, H5S_ALL, H5S_ALL, | 1622 if (class_hid < 0 || H5Dwrite (class_hid, type_hid, H5S_ALL, H5S_ALL, |
1620 H5P_DEFAULT, c_name.c_str ()) < 0) | 1623 H5P_DEFAULT, c_name.c_str ()) < 0) |
1621 goto error_cleanup; | 1624 goto error_cleanup; |
1622 | 1625 |
1623 #if HAVE_HDF5_18 | 1626 #if HAVE_HDF5_18 |
1624 data_hid = H5Gcreate (group_hid, "value", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); | 1627 data_hid = H5Gcreate (group_hid, "value", H5P_DEFAULT, H5P_DEFAULT, |
1628 H5P_DEFAULT); | |
1625 #else | 1629 #else |
1626 data_hid = H5Gcreate (group_hid, "value", 0); | 1630 data_hid = H5Gcreate (group_hid, "value", 0); |
1627 #endif | 1631 #endif |
1628 if (data_hid < 0) | 1632 if (data_hid < 0) |
1629 goto error_cleanup; | 1633 goto error_cleanup; |
1653 break; | 1657 break; |
1654 | 1658 |
1655 i++; | 1659 i++; |
1656 } | 1660 } |
1657 | 1661 |
1658 error_cleanup: | 1662 error_cleanup: |
1659 | 1663 |
1660 if (data_hid > 0) | 1664 if (data_hid > 0) |
1661 H5Gclose (data_hid); | 1665 H5Gclose (data_hid); |
1662 | 1666 |
1663 if (class_hid > 0) | 1667 if (class_hid > 0) |
1804 else | 1808 else |
1805 retval = false; | 1809 retval = false; |
1806 } | 1810 } |
1807 } | 1811 } |
1808 | 1812 |
1809 error_cleanup: | 1813 error_cleanup: |
1810 if (data_hid > 0) | 1814 if (data_hid > 0) |
1811 H5Dclose (data_hid); | 1815 H5Dclose (data_hid); |
1812 | 1816 |
1813 if (data_hid > 0) | 1817 if (data_hid > 0) |
1814 H5Gclose (group_hid); | 1818 H5Gclose (group_hid); |
1919 | 1923 |
1920 return retval; | 1924 return retval; |
1921 } | 1925 } |
1922 | 1926 |
1923 DEFUN (class, args, , | 1927 DEFUN (class, args, , |
1924 "-*- texinfo -*-\n\ | 1928 "-*- texinfo -*-\n\ |
1925 @deftypefn {Function File} {@var{classname} =} class (@var{obj})\n\ | 1929 @deftypefn {Function File} {@var{classname} =} class (@var{obj})\n\ |
1926 @deftypefnx {Function File} {} class (@var{s}, @var{id})\n\ | 1930 @deftypefnx {Function File} {} class (@var{s}, @var{id})\n\ |
1927 @deftypefnx {Function File} {} class (@var{s}, @var{id}, @var{p}, @dots{})\n\ | 1931 @deftypefnx {Function File} {} class (@var{s}, @var{id}, @var{p}, @dots{})\n\ |
1928 Return the class of the object @var{obj} or create a class with\n\ | 1932 Return the class of the object @var{obj} or create a class with\n\ |
1929 fields from structure @var{s} and name (string) @var{id}. Additional\n\ | 1933 fields from structure @var{s} and name (string) @var{id}. Additional\n\ |
2011 %% Test Input Validation | 2015 %% Test Input Validation |
2012 %!error class () | 2016 %!error class () |
2013 */ | 2017 */ |
2014 | 2018 |
2015 DEFUN (__isa_parent__, args, , | 2019 DEFUN (__isa_parent__, args, , |
2016 "-*- texinfo -*-\n\ | 2020 "-*- texinfo -*-\n\ |
2017 @deftypefn {Built-in Function} {} __isa_parent__ (@var{class}, @var{name})\n\ | 2021 @deftypefn {Built-in Function} {} __isa_parent__ (@var{class}, @var{name})\n\ |
2018 Undocumented internal function.\n\ | 2022 Undocumented internal function.\n\ |
2019 @end deftypefn") | 2023 @end deftypefn") |
2020 { | 2024 { |
2021 octave_value retval = false; | 2025 octave_value retval = false; |
2038 | 2042 |
2039 return retval; | 2043 return retval; |
2040 } | 2044 } |
2041 | 2045 |
2042 DEFUN (__parent_classes__, args, , | 2046 DEFUN (__parent_classes__, args, , |
2043 "-*- texinfo -*-\n\ | 2047 "-*- texinfo -*-\n\ |
2044 @deftypefn {Built-in Function} {} __parent_classes__ (@var{x})\n\ | 2048 @deftypefn {Built-in Function} {} __parent_classes__ (@var{x})\n\ |
2045 Undocumented internal function.\n\ | 2049 Undocumented internal function.\n\ |
2046 @end deftypefn") | 2050 @end deftypefn") |
2047 { | 2051 { |
2048 octave_value retval = Cell (); | 2052 octave_value retval = Cell (); |
2059 | 2063 |
2060 return retval; | 2064 return retval; |
2061 } | 2065 } |
2062 | 2066 |
2063 DEFUN (isobject, args, , | 2067 DEFUN (isobject, args, , |
2064 "-*- texinfo -*-\n\ | 2068 "-*- texinfo -*-\n\ |
2065 @deftypefn {Built-in Function} {} isobject (@var{x})\n\ | 2069 @deftypefn {Built-in Function} {} isobject (@var{x})\n\ |
2066 Return true if @var{x} is a class object.\n\ | 2070 Return true if @var{x} is a class object.\n\ |
2067 @seealso{class, typeinfo, isa, ismethod}\n\ | 2071 @seealso{class, typeinfo, isa, ismethod}\n\ |
2068 @end deftypefn") | 2072 @end deftypefn") |
2069 { | 2073 { |
2076 | 2080 |
2077 return retval; | 2081 return retval; |
2078 } | 2082 } |
2079 | 2083 |
2080 DEFUN (ismethod, args, , | 2084 DEFUN (ismethod, args, , |
2081 "-*- texinfo -*-\n\ | 2085 "-*- texinfo -*-\n\ |
2082 @deftypefn {Built-in Function} {} ismethod (@var{x}, @var{method})\n\ | 2086 @deftypefn {Built-in Function} {} ismethod (@var{x}, @var{method})\n\ |
2083 Return true if @var{x} is a class object and the string @var{method}\n\ | 2087 Return true if @var{x} is a class object and the string @var{method}\n\ |
2084 is a method of this class.\n\ | 2088 is a method of this class.\n\ |
2085 @seealso{isobject}\n\ | 2089 @seealso{isobject}\n\ |
2086 @end deftypefn") | 2090 @end deftypefn") |
2118 | 2122 |
2119 return retval; | 2123 return retval; |
2120 } | 2124 } |
2121 | 2125 |
2122 DEFUN (__methods__, args, , | 2126 DEFUN (__methods__, args, , |
2123 "-*- texinfo -*-\n\ | 2127 "-*- texinfo -*-\n\ |
2124 @deftypefn {Built-in Function} {} __methods__ (@var{x})\n\ | 2128 @deftypefn {Built-in Function} {} __methods__ (@var{x})\n\ |
2125 @deftypefnx {Built-in Function} {} __methods__ (\"classname\")\n\ | 2129 @deftypefnx {Built-in Function} {} __methods__ (\"classname\")\n\ |
2126 Internal function.\n\ | 2130 Internal function.\n\ |
2127 \n\ | 2131 \n\ |
2128 Implements @code{methods} for Octave class objects and classnames.\n\ | 2132 Implements @code{methods} for Octave class objects and classnames.\n\ |
2176 | 2180 |
2177 return built_in_class_names.find (cn) != built_in_class_names.end (); | 2181 return built_in_class_names.find (cn) != built_in_class_names.end (); |
2178 } | 2182 } |
2179 | 2183 |
2180 DEFUN (superiorto, args, , | 2184 DEFUN (superiorto, args, , |
2181 "-*- texinfo -*-\n\ | 2185 "-*- texinfo -*-\n\ |
2182 @deftypefn {Built-in Function} {} superiorto (@var{class_name}, @dots{})\n\ | 2186 @deftypefn {Built-in Function} {} superiorto (@var{class_name}, @dots{})\n\ |
2183 When called from a class constructor, mark the object currently\n\ | 2187 When called from a class constructor, mark the object currently\n\ |
2184 constructed as having a higher precedence than @var{class_name}.\n\ | 2188 constructed as having a higher precedence than @var{class_name}.\n\ |
2185 More that one such class can be specified in a single call.\n\ | 2189 More that one such class can be specified in a single call.\n\ |
2186 This function may only be called from a class constructor.\n\ | 2190 This function may only be called from a class constructor.\n\ |
2198 for (int i = 0; i < args.length (); i++) | 2202 for (int i = 0; i < args.length (); i++) |
2199 { | 2203 { |
2200 std::string inf_class = args(i).string_value (); | 2204 std::string inf_class = args(i).string_value (); |
2201 if (error_state) | 2205 if (error_state) |
2202 { | 2206 { |
2203 error ("superiorto: expecting argument to be class name"); | 2207 error ("superiorto: expecting argument to be class name"); |
2204 break; | 2208 break; |
2205 } | 2209 } |
2206 | 2210 |
2207 // User defined classes always have higher precedence | 2211 // User defined classes always have higher precedence |
2208 // than built-in classes | 2212 // than built-in classes |
2209 if (is_built_in_class (inf_class)) | 2213 if (is_built_in_class (inf_class)) |
2220 | 2224 |
2221 return retval; | 2225 return retval; |
2222 } | 2226 } |
2223 | 2227 |
2224 DEFUN (inferiorto, args, , | 2228 DEFUN (inferiorto, args, , |
2225 "-*- texinfo -*-\n\ | 2229 "-*- texinfo -*-\n\ |
2226 @deftypefn {Built-in Function} {} inferiorto (@var{class_name}, @dots{})\n\ | 2230 @deftypefn {Built-in Function} {} inferiorto (@var{class_name}, @dots{})\n\ |
2227 When called from a class constructor, mark the object currently\n\ | 2231 When called from a class constructor, mark the object currently\n\ |
2228 constructed as having a lower precedence than @var{class_name}.\n\ | 2232 constructed as having a lower precedence than @var{class_name}.\n\ |
2229 More that one such class can be specified in a single call.\n\ | 2233 More that one such class can be specified in a single call.\n\ |
2230 This function may only be called from a class constructor.\n\ | 2234 This function may only be called from a class constructor.\n\ |