octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #29447] Cannot create @handles to non-existing


From: Judd Storrs
Subject: [Octave-bug-tracker] [bug #29447] Cannot create @handles to non-existing functions
Date: Tue, 06 Apr 2010 19:01:31 +0000
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.8) Gecko/20100214 Ubuntu/9.10 (karmic) Firefox/3.5.8

Follow-up Comment #8, bug #29447 (project octave):

The invalid handle is explicitly "@crash" and is intended to crash on
evaluation. It's used in a data structure that stores data type information
related to the NIfTI file format. Specifically, @crash is used to mark
currently unsupported datatypes (FLOAT128 and COMPLEX256). For example, in
@file_array/private/datatypes.m:


    t = true;
    f = false;
    table = {...
        0   ,'UNKNOWN'   ,'uint8'   ,@uint8  ,1,1  ,t,t,f
        1   ,'BINARY'    ,'uint1'   ,@logical,1,1/8,t,t,f
        256 ,'INT8'      ,'int8'    ,@int8   ,1,1  ,t,f,t
        2   ,'UINT8'     ,'uint8'   ,@uint8  ,1,1  ,t,t,t
        4   ,'INT16'     ,'int16'   ,@int16  ,1,2  ,t,f,t
        512 ,'UINT16'    ,'uint16'  ,@uint16 ,1,2  ,t,t,t
        8   ,'INT32'     ,'int32'   ,@int32  ,1,4  ,t,f,t
        768 ,'UINT32'    ,'uint32'  ,@uint32 ,1,4  ,t,t,t
        1024,'INT64'     ,'int64'   ,@int64  ,1,8  ,t,f,f
        1280,'UINT64'    ,'uint64'  ,@uint64 ,1,8  ,t,t,f
        16  ,'FLOAT32'   ,'float32' ,@single ,1,4  ,f,f,t
        64  ,'FLOAT64'   ,'double'  ,@double ,1,8  ,f,f,t
        1536,'FLOAT128'  ,'float128',@crash  ,1,16 ,f,f,f
        32  ,'COMPLEX64' ,'float32' ,@single ,2,4  ,f,f,f
        1792,'COMPLEX128','double'  ,@double ,2,8  ,f,f,f
        2048,'COMPLEX256','float128',@crash  ,2,16 ,f,f,f
        128 ,'RGB24'     ,'uint8'   ,@uint8  ,3,1  ,t,t,f};


Probably niftimatlib should include a crash.m if they want to be certain that
their @crash will actually crash ;) 

The mechanisms at work in the following may be usable for building a patch if
we wanted to switch the behavior from fail-on-creation to fail-on-use.


octave:1> type crash
crash is the user-defined function defined from: /tmp/test2/crash.m

function crash()
error("Crash!!")
endfunction

octave:2> func = @crash
func = @crash
octave:3> ^Z
[2]+  Stopped                 octave
$ rm crash.m 
$ fg 
octave:3> func
func = @crash
octave:4> func()
error: crash: no longer valid function handle


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?29447>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]