clibover.gml

来自「开放源码的编译器open watcom 1.6.0版的源代码」· GML 代码 · 共 1,572 行 · 第 1/5 页

GML
1,572
字号
.if '&machsys' ne 'PP' .do begin
The
.kw _nmalloc
function allocates space within this area while the
.kw _fmalloc
function allocates space outside the area (if it is available).
.np
In a small data model, the
.kw malloc
.ct,
.kw calloc
and
.kw realloc
functions use the
.kw _nmalloc
function to acquire memory; in a large data model, the
.kw _fmalloc
function is used.
.np
It is also possible to allocate memory from a based heap using
.kw _bmalloc.
Based heaps are similar to far heaps in that they are located
outside the normal data segment.
Based pointers only store the offset portion of the full address,
so they behave much like near pointers.
The selector portion of the full address specifies which based heap
a based pointer belongs to, and must be passed to the various based
heap functions.
.np
It is important to use the appropriate memory-deallocation function to
free memory blocks.
The
.kw _nfree
function should be used to free space acquired by the
.kw _ncalloc
.ct,
.kw _nmalloc
.ct,
or
.kw _nrealloc
functions.
The
.kw _ffree
function should be used to free space acquired by the
.kw _fcalloc
.ct,
.kw _fmalloc
.ct,
or
.kw _frealloc
functions.
The
.kw _bfree
function should be used to free space acquired by the
.kw _bcalloc
.ct,
.kw _bmalloc
.ct,
or
.kw _brealloc
functions.
.np
The
.kw free
function will use the
.kw _nfree
function when the small data memory model is used; it will use the
.kw _ffree
function when the large data memory model is being used.
.np
It should be noted that the
.kw _fmalloc
and
.kw _nmalloc
functions can both be used in either data memory model.
.do end
.fdbeg
.fd *fun="alloca" allocate auto storage from stack
.fd *fun="_bcalloc" allocate and zero memory from a based heap
.fd *fun="_bexpand" expand a block of memory in a based heap
.fd *fun="_bfree" free a block of memory in a based heap
.fd *fun="_bfreeseg" free a based heap
.fd *fun="_bheapseg" allocate a based heap
.fd *fun="_bmalloc" allocate a memory block from a based heap
.fd *fun="_bmsize" return the size of a memory block
.fd *fun="_brealloc" re-allocate a memory block in a based heap
.fd *fun="calloc" allocate and zero memory
.fd *fun="_expand" expand a block of memory
.fd *fun="_fcalloc" allocate and zero a memory block (outside default data segment)
.fd *fun="_fexpand" expand a block of memory (outside default data segment)
.fd *fun="_ffree" free a block allocated using "_fmalloc"
.fd *fun="_fmalloc" allocate a memory block (outside default data segment)
.fd *fun="_fmsize" return the size of a memory block
.fd *fun="_frealloc" re-allocate a memory block (outside default data segment)
.fd *fun="free" free a block allocated using "malloc", "calloc" or "realloc"
.fd *fun="_freect" return number of objects that can be allocated
.fd *fun="halloc" allocate huge array
.fd *fun="hfree" free huge array
.if '&machsys' eq 'PP' .do begin
.fd *fun="malloc" allocate a memory block
.do end
.el .do begin
.fd *fun="malloc" allocate a memory block (using current memory model)
.do end
.fd *fun="_memavl" return amount of available memory
.fd *fun="_memmax" return largest block of memory available
.fd *fun="_msize" return the size of a memory block
.fd *fun="_ncalloc" allocate and zero a memory block (inside default data segment)
.fd *fun="_nexpand" expand a block of memory (inside default data segment)
.fd *fun="_nfree" free a block allocated using "_nmalloc"
.fd *fun="_nmalloc" allocate a memory block (inside default data segment)
.fd *fun="_nmsize" return the size of a memory block
.fd *fun="_nrealloc" re-allocate a memory block (inside default data segment)
.fd *fun="realloc" re-allocate a block of memory
.fd *fun="sbrk" set allocation "break" position
.fd *fun="_smalloc" allocate a memory block from a shared heap
.fd *fun="stackavail" determine available amount of stack space
.fdend
.*======================================================================
.section Heap Functions
.*
.np
.ix '&Heap'
These functions provide the ability to shrink and grow the heap,
as well as, find heap related problems.
.fdbeg
.fd *fun="_heapchk" perform consistency check on the heap
.fd *fun="_bheapchk" perform consistency check on a based heap
.fd *fun="_fheapchk" perform consistency check on the far heap
.fd *fun="_nheapchk" perform consistency check on the near heap
.fd *fun="_heapgrow" grow the heap
.fd *fun="_fheapgrow" grow the far heap
.fd *fun="_nheapgrow" grow the near heap up to its limit of 64K
.fd *fun="_heapmin" shrink the heap as small as possible
.fd *fun="_bheapmin" shrink a based heap as small as possible
.fd *fun="_fheapmin" shrink the far heap as small as possible
.fd *fun="_nheapmin" shrink the near heap as small as possible
.fd *fun="_heapset" fill unallocated sections of heap with pattern
.fd *fun="_bheapset" fill unallocated sections of based heap with pattern
.fd *fun="_fheapset" fill unallocated sections of far heap with pattern
.fd *fun="_nheapset" fill unallocated sections of near heap with pattern
.fd *fun="_heapshrink" shrink the heap as small as possible
.fd *fun="_fheapshrink" shrink the far heap as small as possible
.fd *fun="_bheapshrink" shrink a based heap as small as possible
.fd *fun="_nheapshrink" shrink the near heap as small as possible
.fd *fun="_heapwalk" walk through each entry in the heap
.fd *fun="_bheapwalk" walk through each entry in a based heap
.fd *fun="_fheapwalk" walk through each entry in the far heap
.fd *fun="_nheapwalk" walk through each entry in the near heap
.fdend
.*======================================================================
.section Math Functions
.*
.np
.ix '&Math'
.ix '&Trig'
These functions operate with objects of type
.id double,
also known as floating-point numbers.
The Intel 8087 processor (and its successor chips) is commonly used
to implement floating-point operations on personal computers.
Functions ending in "87" pertain to this specific hardware
and should be isolated in programs when portability is a consideration.
.fdbeg
.fd *fun="abs" absolute value of an object of type "int"
.fd *fun="acos" arccosine
.fd *fun="acosh" inverse hyperbolic cosine
.fd *fun="asin" arcsine
.fd *fun="asinh" inverse hyperbolic sine
.fd *fun="atan" arctangent of one argument
.fd *fun="atan2" arctangent of two arguments
.fd *fun="atanh" inverse hyperbolic tangent
.fd *fun="bessel" bessel functions j0, j1, jn, y0, y1, and yn
.fd *fun="cabs" absolute value of complex number
.fd *fun="ceil" ceiling function
.fd *fun="_clear87" clears floating-point status
.fd *fun="_control87" sets new floating-point control word
.fd *fun="cos" cosine
.fd *fun="cosh" hyperbolic cosine
.fd *fun="div" compute quotient, remainder from division of an "int" object
.fd *fun="exp" exponential function
.fd *fun="fabs" absolute value of "double"
.fd *fun="_finite" determines whether floating-point value is valid
.fd *fun="floor" floor function
.fd *fun="fmod" modulus function
.fd *fun="_fpreset" initializes for floating-point operations
.fd *fun="frexp" fractional exponent
.fd *fun="hypot" compute hypotenuse
.fd *fun="imaxabs" get quotient, remainder from division of object of maximum-size integer type
.fd *fun="imaxdiv" absolute value of an object of maximum-size integer type
.fd *fun="j0" return Bessel functions of the first kind (described under "bessel Functions")
.fd *fun="j1" return Bessel functions of the first kind (described under "bessel Functions")
.fd *fun="jn" return Bessel functions of the first kind (described under "bessel Functions")
.fd *fun="labs" absolute value of an object of type "long int"
.fd *fun="ldexp" multiply by a power of two
.fd *fun="ldiv" get quotient, remainder from division of object of type "long int"
.fd *fun="log" natural logarithm
.fd *fun="log10" logarithm, base 10
.fd *fun="log2" logarithm, base 2
.fd *fun="matherr" handles error from math functions
.fd *fun="max" return maximum of two arguments
.fd *fun="min" return minimum of two arguments
.fd *fun="modf" get integral, fractional parts of "double"
.fd *fun="pow" raise to power
.fd *fun="rand" random integer
.fd *fun="_set_matherr" specify a math error handler
.fd *fun="sin" sine
.fd *fun="sinh" hyperbolic sine
.fd *fun="sqrt" square root
.fd *fun="srand" set starting point for generation of random numbers using "rand" function
.fd *fun="_status87" gets floating-point status
.fd *fun="tan" tangent
.fd *fun="tanh" hyperbolic tangent
.fd *fun="y0" return Bessel functions of the second kind (described under "bessel")
.fd *fun="y1" return Bessel functions of the second kind (described under "bessel")
.fd *fun="yn" return Bessel functions of the second kind (described under "bessel")
.fdend
.*======================================================================
.section Searching Functions
.*
.np
.ix 'Searching Functions'
These functions provide searching and sorting capabilities.
.fdbeg
.fd *fun="bsearch" find a data item in an array using binary search
.fd *fun="lfind" find a data item in an array using linear search
.fd *fun="lsearch" linear search array, add item if not found
.fd *fun="qsort" sort an array
.fdend
.*======================================================================
.section Time Functions
.*
.np
.ix 'Time Functions'
These functions are concerned with dates and times.
.fdbeg
.fd *fun="asctime" makes time string from time structure
.fd *fun="_asctime" makes time string from time structure
.fd *fun="_wasctime" makes time string from time structure
.fd *fun="__wasctime" makes time string from time structure
.fd *fun="clock" gets time since program start
.fd *fun="ctime" gets calendar time string
.fd *fun="_ctime" gets calendar time string
.fd *fun="_wctime" gets calendar time string
.fd *fun="__wctime" gets calendar time string
.fd *fun="difftime" calculate difference between two times
.fd *fun="ftime" returns the current time in a "timeb" structure
.fd *fun="gmtime" convert calendar time to Coordinated Universal Time (UTC)
.fd *fun="_gmtime" convert calendar time to Coordinated Universal Time (UTC)
.fd *fun="localtime" convert calendar time to local time
.fd *fun="_localtime" convert calendar time to local time
.fd *fun="mktime" make calendar time from local time
.fd *fun="_strdate" return date in buffer
.fd *fun="strftime" format date and time
.fd *fun="wcsftime" format date and time
.fd *fun="_wstrftime_ms" format date and time
.fd *fun="_strtime" return time in buffer
.fd *fun="_wstrtime" return time in buffer
.fd *fun="time" get current calendar time
.fd *fun="tzset" set global variables to reflect the local time zone
.fd *fun="_wstrdate" return date in buffer
.fdend
.*======================================================================
.section Variable-length Argument Lists
.*
.np
.ix 'variable arguments'
Variable-length argument lists are used
when a function does not have a fixed number of arguments.
These macros provide the capability to access these arguments.
.fdbeg
.fd *fun="va_arg" get next variable argument
.fd *fun="va_end" complete access of variable arguments
.fd *fun="va_start" start access of variable arguments
.fdend
.*======================================================================
.section Stream I/O Functions
.*
.np
.ix '&StrIo'
A
.us stream
is the name given to a file or device which has been opened for
data transmission.
When a stream is opened, a pointer to a
.kw FILE
structure is returned.
This pointer is used to reference the stream when other functions
are subsequently invoked.
.if '&machsys' ne 'QNX' .do begin
.np
There are two modes by which data can be transmitted:
.begnote
.note binary
Data is transmitted unchanged.
.note text
On input, carriage-return characters are removed before
following linefeed characters.
On output, carriage-return characters are inserted before linefeed
characters.
.endnote
.np
These modes are required since text files are stored with the two
characters delimiting a line of text, while the C convention is
for only the linefeed character to delimit a text line.
.do end
.np
When a program begins execution, there are a number of streams
already open for use:
.begnote
.note stdin
.ix '&KbIo' stdin
.ix stdin
Standard Input: input from the
console

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?