KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17
System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64
User : nobody ( 99)
PHP Version : 5.2.17
Disable Function : NONE
Directory :  /proc/21585/root/usr/share/gtk-doc/html/glib/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/21585/root/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Standard Macros</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
<link rel="start" href="index.html" title="GLib Reference Manual">
<link rel="up" href="glib-fundamentals.html" title="GLib Fundamentals">
<link rel="prev" href="glib-Limits-of-Basic-Types.html" title="Limits of Basic Types">
<link rel="next" href="glib-Type-Conversion-Macros.html" title="Type Conversion Macros">
<meta name="generator" content="GTK-Doc V1.6 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="glib.html" title="GLib Overview">
<link rel="chapter" href="glib-fundamentals.html" title="GLib Fundamentals">
<link rel="chapter" href="glib-core.html" title="GLib Core Application Support">
<link rel="chapter" href="glib-utilities.html" title="GLib Utilities">
<link rel="chapter" href="glib-data-types.html" title="GLib Data Types">
<link rel="chapter" href="tools.html" title="GLib Tools">
<link rel="index" href="ix01.html" title="Index">
<link rel="index" href="ix02.html" title="Index of deprecated symbols">
<link rel="index" href="ix03.html" title="Index of new symbols in 2.2">
<link rel="index" href="ix04.html" title="Index of new symbols in 2.4">
<link rel="index" href="ix05.html" title="Index of new symbols in 2.6">
<link rel="index" href="ix06.html" title="Index of new symbols in 2.8">
<link rel="index" href="ix07.html" title="Index of new symbols in 2.10">
<link rel="index" href="ix08.html" title="Index of new symbols in 2.12">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="glib-Limits-of-Basic-Types.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="glib-fundamentals.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GLib Reference Manual</th>
<td><a accesskey="n" href="glib-Type-Conversion-Macros.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id2853380" class="shortcut">Top</a>
                  &#160;|&#160;
                  <a href="#id2853558" class="shortcut">Description</a></nobr></td></tr>
</table>
<div class="refentry" lang="en">
<a name="glib-Standard-Macros"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2>
<a name="id2853380"></a><span class="refentrytitle">Standard Macros</span>
</h2>
<p>Standard Macros &#8212; commonly-used macros.</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">

#include &lt;glib.h&gt;



#define     <a href="glib-Standard-Macros.html#G-OS-WIN32:CAPS">G_OS_WIN32</a>
#define     <a href="glib-Standard-Macros.html#G-OS-BEOS:CAPS">G_OS_BEOS</a>
#define     <a href="glib-Standard-Macros.html#G-OS-UNIX:CAPS">G_OS_UNIX</a>

#define     <a href="glib-Standard-Macros.html#G-DIR-SEPARATOR:CAPS">G_DIR_SEPARATOR</a>
#define     <a href="glib-Standard-Macros.html#G-DIR-SEPARATOR-S:CAPS">G_DIR_SEPARATOR_S</a>
#define     <a href="glib-Standard-Macros.html#G-IS-DIR-SEPARATOR:CAPS">G_IS_DIR_SEPARATOR</a>              (c)
#define     <a href="glib-Standard-Macros.html#G-SEARCHPATH-SEPARATOR:CAPS">G_SEARCHPATH_SEPARATOR</a>
#define     <a href="glib-Standard-Macros.html#G-SEARCHPATH-SEPARATOR-S:CAPS">G_SEARCHPATH_SEPARATOR_S</a>

#define     <a href="glib-Standard-Macros.html#TRUE:CAPS">TRUE</a>
#define     <a href="glib-Standard-Macros.html#FALSE:CAPS">FALSE</a>

#define     <a href="glib-Standard-Macros.html#NULL:CAPS">NULL</a>

#define     <a href="glib-Standard-Macros.html#MIN:CAPS">MIN</a>                             (a, b)
#define     <a href="glib-Standard-Macros.html#MAX:CAPS">MAX</a>                             (a, b)

#define     <a href="glib-Standard-Macros.html#ABS:CAPS">ABS</a>                             (a)
#define     <a href="glib-Standard-Macros.html#CLAMP:CAPS">CLAMP</a>                           (x, low, high)

#define     <a href="glib-Standard-Macros.html#G-STRUCT-MEMBER:CAPS">G_STRUCT_MEMBER</a>                 (member_type, struct_p, struct_offset)
#define     <a href="glib-Standard-Macros.html#G-STRUCT-MEMBER-P:CAPS">G_STRUCT_MEMBER_P</a>               (struct_p, struct_offset)
#define     <a href="glib-Standard-Macros.html#G-STRUCT-OFFSET:CAPS">G_STRUCT_OFFSET</a>                 (struct_type, member)

#define     <a href="glib-Standard-Macros.html#G-MEM-ALIGN:CAPS">G_MEM_ALIGN</a>

#define     <a href="glib-Standard-Macros.html#G-CONST-RETURN:CAPS">G_CONST_RETURN</a>
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id2853558"></a><h2>Description</h2>
<p>
These macros provide a few commonly-used features.
</p>
</div>
<div class="refsect1" lang="en">
<a name="id2853574"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="id2853584"></a><h3>
<a name="G-OS-WIN32:CAPS"></a>G_OS_WIN32</h3>
<a class="indexterm" name="id2853596"></a><pre class="programlisting">#define G_OS_WIN32
</pre>
<p>
This macro is defined only on Windows. So you can bracket
Windows-specific code in "#ifdef G_OS_WIN32".
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2853619"></a><h3>
<a name="G-OS-BEOS:CAPS"></a>G_OS_BEOS</h3>
<a class="indexterm" name="id2853626"></a><pre class="programlisting">#define G_OS_BEOS
</pre>
<p>
This macro is defined only on BeOS. So you can bracket
BeOS-specific code in "#ifdef G_OS_BEOS".
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2853639"></a><h3>
<a name="G-OS-UNIX:CAPS"></a>G_OS_UNIX</h3>
<a class="indexterm" name="id2853654"></a><pre class="programlisting">#define G_OS_UNIX
</pre>
<p>
This macro is defined only on UNIX. So you can bracket
UNIX-specific code in "#ifdef G_OS_UNIX".
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2853672"></a><h3>
<a name="G-DIR-SEPARATOR:CAPS"></a>G_DIR_SEPARATOR</h3>
<a class="indexterm" name="id2853688"></a><pre class="programlisting">#define     G_DIR_SEPARATOR</pre>
<p>
The directory separator character.
This is '/' on UNIX machines and '\' under Windows.
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2853704"></a><h3>
<a name="G-DIR-SEPARATOR-S:CAPS"></a>G_DIR_SEPARATOR_S</h3>
<a class="indexterm" name="id2853717"></a><pre class="programlisting">#define     G_DIR_SEPARATOR_S</pre>
<p>
The directory separator as a string.
This is "/" on UNIX machines and "\" under Windows.
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2853734"></a><h3>
<a name="G-IS-DIR-SEPARATOR:CAPS"></a>G_IS_DIR_SEPARATOR()</h3>
<a class="indexterm" name="id2853748"></a><pre class="programlisting">#define     G_IS_DIR_SEPARATOR(c)</pre>
<p>
Checks whether a character is a directory 
separator. It returns <a href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> for '/' on UNIX
machines and for '\' or '/' under Windows.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td>
<span class="term"><em class="parameter"><code>c</code></em>&#160;:</span></td>
<td>a character
</td>
</tr></tbody>
</table></div>
<p>Since 2.6


</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2853800"></a><h3>
<a name="G-SEARCHPATH-SEPARATOR:CAPS"></a>G_SEARCHPATH_SEPARATOR</h3>
<a class="indexterm" name="id2853813"></a><pre class="programlisting">#define     G_SEARCHPATH_SEPARATOR</pre>
<p>
The search path separator character.
This is ':' on UNIX machines and ';' under Windows.
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2853830"></a><h3>
<a name="G-SEARCHPATH-SEPARATOR-S:CAPS"></a>G_SEARCHPATH_SEPARATOR_S</h3>
<a class="indexterm" name="id2853844"></a><pre class="programlisting">#define     G_SEARCHPATH_SEPARATOR_S</pre>
<p>
The search path separator as a string.
This is ":" on UNIX machines and ";" under Windows.
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2853860"></a><h3>
<a name="TRUE:CAPS"></a>TRUE</h3>
<a class="indexterm" name="id2853872"></a><pre class="programlisting">#define	TRUE	(!FALSE)
</pre>
<p>
Defines the <a href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> value for the <a href="glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> type.
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2853906"></a><h3>
<a name="FALSE:CAPS"></a>FALSE</h3>
<a class="indexterm" name="id2853918"></a><pre class="programlisting">#define	FALSE	(0)
</pre>
<p>
Defines the <a href="glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> value for the <a href="glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> type.
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2853952"></a><h3>
<a name="NULL:CAPS"></a>NULL</h3>
<a class="indexterm" name="id2853965"></a><pre class="programlisting">#define     NULL</pre>
<p>
Defines the standard <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> pointer.
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2853990"></a><h3>
<a name="MIN:CAPS"></a>MIN()</h3>
<a class="indexterm" name="id2854003"></a><pre class="programlisting">#define MIN(a, b)  (((a) &lt; (b)) ? (a) : (b))
</pre>
<p>
Calculates the minimum of <em class="parameter"><code>a</code></em> and <em class="parameter"><code>b</code></em>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>a</code></em>&#160;:</span></td>
<td>a numeric value.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>b</code></em>&#160;:</span></td>
<td>a numeric value.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td>the minimum of <em class="parameter"><code>a</code></em> and <em class="parameter"><code>b</code></em>.


</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2854084"></a><h3>
<a name="MAX:CAPS"></a>MAX()</h3>
<a class="indexterm" name="id2854096"></a><pre class="programlisting">#define MAX(a, b)  (((a) &gt; (b)) ? (a) : (b))
</pre>
<p>
Calculates the maximum of <em class="parameter"><code>a</code></em> and <em class="parameter"><code>b</code></em>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>a</code></em>&#160;:</span></td>
<td>a numeric value.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>b</code></em>&#160;:</span></td>
<td>a numeric value.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td>the maximum of <em class="parameter"><code>a</code></em> and <em class="parameter"><code>b</code></em>.


</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2854176"></a><h3>
<a name="ABS:CAPS"></a>ABS()</h3>
<a class="indexterm" name="id2854188"></a><pre class="programlisting">#define ABS(a)	   (((a) &lt; 0) ? -(a) : (a))
</pre>
<p>
Calculates the absolute value of <em class="parameter"><code>a</code></em>.
The absolute value is simply the number with any negative sign taken away.
</p>
<p>
For example,
</p>
<div class="itemizedlist"><ul type="disc">
<li><p>
ABS(-10) is 10.
</p></li>
<li><p>
ABS(10) is also 10.
</p></li>
</ul></div>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>a</code></em>&#160;:</span></td>
<td>a numeric value.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td>the absolute value of <em class="parameter"><code>a</code></em>.


</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2854259"></a><h3>
<a name="CLAMP:CAPS"></a>CLAMP()</h3>
<a class="indexterm" name="id2854271"></a><pre class="programlisting">#define CLAMP(x, low, high)  (((x) &gt; (high)) ? (high) : (((x) &lt; (low)) ? (low) : (x)))
</pre>
<p>
Ensures that <em class="parameter"><code>x</code></em> is between the limits set by <em class="parameter"><code>low</code></em> and <em class="parameter"><code>high</code></em>.
</p>
<p>
For example,
</p>
<div class="itemizedlist"><ul type="disc">
<li><p>
CLAMP(5, 10, 15) is 10.
</p></li>
<li><p>
CLAMP(15, 5, 10) is 10.
</p></li>
<li><p>
CLAMP(20, 15, 25) is 20.
</p></li>
</ul></div>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>x</code></em>&#160;:</span></td>
<td>the value to clamp.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>low</code></em>&#160;:</span></td>
<td>the minimum value allowed.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>high</code></em>&#160;:</span></td>
<td>the maximum value allowed.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td>the value of <em class="parameter"><code>x</code></em> clamped to the range between <em class="parameter"><code>low</code></em> and <em class="parameter"><code>high</code></em>.


</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2854403"></a><h3>
<a name="G-STRUCT-MEMBER:CAPS"></a>G_STRUCT_MEMBER()</h3>
<a class="indexterm" name="id2854416"></a><pre class="programlisting">#define     G_STRUCT_MEMBER(member_type, struct_p, struct_offset)</pre>
<p>
Returns a member of a structure at a given offset, using the given type.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>member_type</code></em>&#160;:</span></td>
<td>the type of the struct field.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>struct_p</code></em>&#160;:</span></td>
<td>a pointer to a struct.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>struct_offset</code></em>&#160;:</span></td>
<td>the offset of the field from the start of the struct, in bytes.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td>the struct member.


</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2854491"></a><h3>
<a name="G-STRUCT-MEMBER-P:CAPS"></a>G_STRUCT_MEMBER_P()</h3>
<a class="indexterm" name="id2854504"></a><pre class="programlisting">#define     G_STRUCT_MEMBER_P(struct_p, struct_offset)</pre>
<p>
Returns an untyped pointer to a given offset of a struct.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>struct_p</code></em>&#160;:</span></td>
<td>a pointer to a struct.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>struct_offset</code></em>&#160;:</span></td>
<td>the offset from the start of the struct, in bytes.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td>an untyped pointer to <em class="parameter"><code>struct_p</code></em> plus <em class="parameter"><code>struct_offset</code></em> bytes.


</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2854576"></a><h3>
<a name="G-STRUCT-OFFSET:CAPS"></a>G_STRUCT_OFFSET()</h3>
<a class="indexterm" name="id2854589"></a><pre class="programlisting">#define     G_STRUCT_OFFSET(struct_type, member)</pre>
<p>
Returns the offset, in bytes, of a member of a struct.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>struct_type</code></em>&#160;:</span></td>
<td>a structure type, e.g. <span class="structname">GtkWidget</span>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>member</code></em>&#160;:</span></td>
<td>a field in the structure, e.g. <em class="structfield"><code>window</code></em>.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td>the offset of <em class="parameter"><code>member</code></em> from the start of <em class="parameter"><code>struct_type</code></em>.


</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2854667"></a><h3>
<a name="G-MEM-ALIGN:CAPS"></a>G_MEM_ALIGN</h3>
<a class="indexterm" name="id2854680"></a><pre class="programlisting">#define     G_MEM_ALIGN</pre>
<p>
Indicates the number of bytes to which memory will be aligned on the
current platform.
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2854696"></a><h3>
<a name="G-CONST-RETURN:CAPS"></a>G_CONST_RETURN</h3>
<a class="indexterm" name="id2854709"></a><pre class="programlisting">#define     G_CONST_RETURN</pre>
<p>
If <code class="literal">G_DISABLE_CONST_RETURNS</code> is defined, this macro expands to nothing.
By default, the macro expands to <code class="literal">const</code>. The macro 
should be used in place of <code class="literal">const</code> for functions that 
return a value that should not be modified. The purpose of this macro is 
to allow us to turn on <code class="literal">const</code> for returned constant 
strings by default, while allowing programmers who find that annoying to 
turn it off. This macro should only be used for return values and for
<span class="emphasis"><em>out</em></span> parameters, it doesn't make sense for 
<span class="emphasis"><em>in</em></span> parameters. 
</p>
</div>
</div>
</div>
</body>
</html>

Anon7 - 2021