/src/wrappers/common/library/obsolete/expanded_wrapper.e
Specman e | 71 lines | 41 code | 8 blank | 22 comment | 2 complexity | 480eec753cf0b7b1eaeb201945559c94 MD5 | raw file
1indexing 2 description: 3 "." 4 copyright: 5 "[ 6 Copyright (C) 2008 Paolo Redaelli 7 8 This library is free software; you can redistribute it and/or 9 modify it under the terms of the GNU Lesser General Public License 10 as published by the Free Software Foundation; either version 2.1 of 11 the License, or (at your option) any later version. 12 13 This library is distributed in the hope that it will be useful, but 14 WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 Lesser General Public License for more details. 17 18 You should have received a copy of the GNU Lesser General Public 19 License along with this library; if not, write to the Free Software 20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 21 02110-1301 USA 22 ]" 23deferred class EXPANDED_WRAPPER 24 -- A wrapper for an object on the stack 25 -- WARNING: This class will be not useful anymore when external types will 26 -- be available and fully tested. 27 28inherit 29 C_STRUCT 30 redefine allocate 31 end 32 C_OWNED 33 INTERNALS_HANDLER 34 undefine copy, is_equal 35 end 36 37feature {} -- 38 allocate is 39 do 40 handle := alloca(struct_size) 41 end 42 43 alloca (a_size: INTEGER): POINTER is 44 -- The alloca() function allocates size bytes of space in the 45 -- stack frame of the caller. This temporary space is 46 -- automatically freed when the function that called alloca() 47 -- returns to its caller. 48 -- The alloca() function returns a pointer to the beginning of 49 -- the allocated space. If the allocation causes stack 50 -- overflow, program behavior is undefined. 51 -- The alloca() function is machine- and compiler-dependent. 52 -- For certain applications, its use can improve efficiency 53 -- compared to the use of malloc(3) plus free(3). In certain 54 -- cases, it can also simplify memory deallocation in 55 -- applications that use longjmp(3) or siglongjmp(3). 56 -- Otherwise, its use is discouraged. 57 -- Because the space allocated by alloca() is allocated 58 -- within the stack frame, that space is automatically freed 59 -- if the function return is jumped over by a call to 60 -- longjmp(3) or siglongjmp(3). 61 require 62 positive: a_size > 0 63 external "C use <alloca.h>" 64 end 65 66invariant 67 used_in_expanded_types: to_internals.type_is_expanded 68 -- When using previous versions of the compiler (<2.3) 69 -- this invariant would become `is_expanded_type' 70 71end -- class EXPANDED_WRAPPER