2011-08-11 11:54:31 +02:00
|
|
|
/*
|
|
|
|
* Copyright © 2011 Google, Inc.
|
|
|
|
*
|
|
|
|
* This is part of HarfBuzz, a text shaping library.
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, without written agreement and without
|
|
|
|
* license or royalty fees, to use, copy, modify, and distribute this
|
|
|
|
* software and its documentation for any purpose, provided that the
|
|
|
|
* above copyright notice and the following two paragraphs appear in
|
|
|
|
* all copies of this software.
|
|
|
|
*
|
|
|
|
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
|
|
|
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
|
|
|
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
|
|
|
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
|
|
|
* DAMAGE.
|
|
|
|
*
|
|
|
|
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
|
|
|
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
|
|
|
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
|
|
|
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
|
|
|
*
|
|
|
|
* Google Author(s): Behdad Esfahbod
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef OPTIONS_HH
|
|
|
|
#define OPTIONS_HH
|
|
|
|
|
|
|
|
|
2011-09-19 22:41:17 +02:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <math.h>
|
|
|
|
#include <locale.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <fcntl.h>
|
2012-05-13 02:02:58 +02:00
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
#include <unistd.h> /* for isatty() */
|
|
|
|
#endif
|
2013-02-12 21:35:32 +01:00
|
|
|
#if defined(_WIN32) || defined(__CYGWIN__)
|
2013-02-01 00:18:05 +01:00
|
|
|
#include <io.h> /* for setmode() under Windows */
|
2011-09-19 22:41:17 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <hb.h>
|
2012-05-16 05:53:18 +02:00
|
|
|
#ifdef HAVE_OT
|
|
|
|
#include <hb-ot.h>
|
|
|
|
#endif
|
2011-09-19 22:41:17 +02:00
|
|
|
#include <glib.h>
|
|
|
|
#include <glib/gprintf.h>
|
|
|
|
|
2012-04-12 21:50:40 +02:00
|
|
|
#undef MIN
|
|
|
|
template <typename Type> static inline Type MIN (const Type &a, const Type &b) { return a < b ? a : b; }
|
|
|
|
|
|
|
|
#undef MAX
|
|
|
|
template <typename Type> static inline Type MAX (const Type &a, const Type &b) { return a > b ? a : b; }
|
|
|
|
|
|
|
|
|
2011-09-19 22:41:17 +02:00
|
|
|
void fail (hb_bool_t suggest_help, const char *format, ...) G_GNUC_NORETURN;
|
|
|
|
|
|
|
|
|
2011-09-20 20:43:55 +02:00
|
|
|
extern hb_bool_t debug;
|
2011-09-13 19:30:39 +02:00
|
|
|
|
|
|
|
struct option_group_t
|
|
|
|
{
|
|
|
|
virtual void add_options (struct option_parser_t *parser) = 0;
|
|
|
|
|
|
|
|
virtual void pre_parse (GError **error G_GNUC_UNUSED) {};
|
|
|
|
virtual void post_parse (GError **error G_GNUC_UNUSED) {};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct option_parser_t
|
|
|
|
{
|
|
|
|
option_parser_t (const char *usage) {
|
|
|
|
memset (this, 0, sizeof (*this));
|
|
|
|
usage_str = usage;
|
|
|
|
context = g_option_context_new (usage);
|
|
|
|
|
|
|
|
add_main_options ();
|
|
|
|
}
|
|
|
|
~option_parser_t (void) {
|
|
|
|
g_option_context_free (context);
|
|
|
|
}
|
|
|
|
|
|
|
|
void add_main_options (void);
|
|
|
|
|
|
|
|
void add_group (GOptionEntry *entries,
|
|
|
|
const gchar *name,
|
|
|
|
const gchar *description,
|
|
|
|
const gchar *help_description,
|
|
|
|
option_group_t *option_group);
|
|
|
|
|
|
|
|
void parse (int *argc, char ***argv);
|
|
|
|
|
|
|
|
G_GNUC_NORETURN void usage (void) {
|
|
|
|
g_printerr ("Usage: %s [OPTION...] %s\n", g_get_prgname (), usage_str);
|
|
|
|
exit (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *usage_str;
|
|
|
|
GOptionContext *context;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2012-05-13 12:51:02 +02:00
|
|
|
#define DEFAULT_MARGIN 16
|
2011-09-08 22:00:04 +02:00
|
|
|
#define DEFAULT_FORE "#000000"
|
|
|
|
#define DEFAULT_BACK "#FFFFFF"
|
2012-05-12 15:41:48 +02:00
|
|
|
#define DEFAULT_FONT_SIZE 256
|
2011-09-08 22:00:04 +02:00
|
|
|
|
2011-09-13 19:30:39 +02:00
|
|
|
struct view_options_t : option_group_t
|
2011-08-11 11:54:31 +02:00
|
|
|
{
|
2011-09-13 19:30:39 +02:00
|
|
|
view_options_t (option_parser_t *parser) {
|
|
|
|
annotate = false;
|
2011-09-08 22:00:04 +02:00
|
|
|
fore = DEFAULT_FORE;
|
|
|
|
back = DEFAULT_BACK;
|
2011-09-13 19:30:39 +02:00
|
|
|
line_space = 0;
|
2011-09-08 22:00:04 +02:00
|
|
|
margin.t = margin.r = margin.b = margin.l = DEFAULT_MARGIN;
|
2011-09-19 15:58:55 +02:00
|
|
|
font_size = DEFAULT_FONT_SIZE;
|
2011-09-13 19:30:39 +02:00
|
|
|
|
|
|
|
add_options (parser);
|
2011-08-11 11:54:31 +02:00
|
|
|
}
|
|
|
|
|
2011-09-13 19:30:39 +02:00
|
|
|
void add_options (option_parser_t *parser);
|
2011-09-08 23:08:32 +02:00
|
|
|
|
2011-09-20 20:43:55 +02:00
|
|
|
hb_bool_t annotate;
|
2011-08-11 11:54:31 +02:00
|
|
|
const char *fore;
|
|
|
|
const char *back;
|
|
|
|
double line_space;
|
|
|
|
struct margin_t {
|
|
|
|
double t, r, b, l;
|
|
|
|
} margin;
|
2011-09-19 15:58:55 +02:00
|
|
|
double font_size;
|
2011-09-13 19:30:39 +02:00
|
|
|
};
|
2011-08-11 11:54:31 +02:00
|
|
|
|
2011-09-08 22:00:04 +02:00
|
|
|
|
2011-09-13 19:30:39 +02:00
|
|
|
struct shape_options_t : option_group_t
|
2011-08-11 11:54:31 +02:00
|
|
|
{
|
2012-06-02 18:21:19 +02:00
|
|
|
shape_options_t (option_parser_t *parser)
|
|
|
|
{
|
2011-09-13 19:30:39 +02:00
|
|
|
direction = language = script = NULL;
|
2012-11-14 00:33:27 +01:00
|
|
|
bot = eot = preserve_default_ignorables = false;
|
2011-09-13 19:30:39 +02:00
|
|
|
features = NULL;
|
|
|
|
num_features = 0;
|
|
|
|
shapers = NULL;
|
2012-04-17 00:08:20 +02:00
|
|
|
utf8_clusters = false;
|
2012-07-17 23:09:29 +02:00
|
|
|
normalize_glyphs = false;
|
2013-04-11 22:31:01 +02:00
|
|
|
num_iterations = 1;
|
2011-09-13 19:30:39 +02:00
|
|
|
|
|
|
|
add_options (parser);
|
2011-08-11 11:54:31 +02:00
|
|
|
}
|
2012-06-02 18:21:19 +02:00
|
|
|
~shape_options_t (void)
|
|
|
|
{
|
2011-09-08 22:42:37 +02:00
|
|
|
free (features);
|
2012-08-07 04:42:47 +02:00
|
|
|
g_strfreev (shapers);
|
2011-09-08 22:42:37 +02:00
|
|
|
}
|
2011-08-11 11:54:31 +02:00
|
|
|
|
2011-09-13 19:30:39 +02:00
|
|
|
void add_options (option_parser_t *parser);
|
2011-09-08 23:08:32 +02:00
|
|
|
|
2012-06-02 18:21:19 +02:00
|
|
|
void setup_buffer (hb_buffer_t *buffer)
|
|
|
|
{
|
2011-09-08 22:50:24 +02:00
|
|
|
hb_buffer_set_direction (buffer, hb_direction_from_string (direction, -1));
|
|
|
|
hb_buffer_set_script (buffer, hb_script_from_string (script, -1));
|
|
|
|
hb_buffer_set_language (buffer, hb_language_from_string (language, -1));
|
2012-11-14 00:33:27 +01:00
|
|
|
hb_buffer_set_flags (buffer, (hb_buffer_flags_t) (HB_BUFFER_FLAGS_DEFAULT |
|
|
|
|
(bot ? HB_BUFFER_FLAG_BOT : 0) |
|
|
|
|
(eot ? HB_BUFFER_FLAG_EOT : 0) |
|
|
|
|
(preserve_default_ignorables ? HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES : 0)));
|
2013-02-15 13:51:47 +01:00
|
|
|
hb_buffer_guess_segment_properties (buffer);
|
2011-09-08 22:49:02 +02:00
|
|
|
}
|
|
|
|
|
2012-11-14 00:12:24 +01:00
|
|
|
void populate_buffer (hb_buffer_t *buffer, const char *text, int text_len,
|
|
|
|
const char *text_before, const char *text_after)
|
2012-06-02 18:21:19 +02:00
|
|
|
{
|
2013-01-07 23:46:37 +01:00
|
|
|
hb_buffer_clear_contents (buffer);
|
2012-11-14 00:12:24 +01:00
|
|
|
if (text_before) {
|
|
|
|
unsigned int len = strlen (text_before);
|
|
|
|
hb_buffer_add_utf8 (buffer, text_before, len, len, 0);
|
|
|
|
}
|
2011-09-13 19:30:39 +02:00
|
|
|
hb_buffer_add_utf8 (buffer, text, text_len, 0, text_len);
|
2012-11-14 00:12:24 +01:00
|
|
|
if (text_after) {
|
|
|
|
hb_buffer_add_utf8 (buffer, text_after, -1, 0, 0);
|
|
|
|
}
|
2012-01-22 01:07:22 +01:00
|
|
|
|
2012-04-17 00:08:20 +02:00
|
|
|
if (!utf8_clusters) {
|
|
|
|
/* Reset cluster values to refer to Unicode character index
|
|
|
|
* instead of UTF-8 index. */
|
|
|
|
unsigned int num_glyphs = hb_buffer_get_length (buffer);
|
|
|
|
hb_glyph_info_t *info = hb_buffer_get_glyph_infos (buffer, NULL);
|
|
|
|
for (unsigned int i = 0; i < num_glyphs; i++)
|
|
|
|
{
|
|
|
|
info->cluster = i;
|
|
|
|
info++;
|
|
|
|
}
|
2012-01-22 01:07:22 +01:00
|
|
|
}
|
|
|
|
|
2011-09-08 22:49:02 +02:00
|
|
|
setup_buffer (buffer);
|
2012-06-02 18:21:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
hb_bool_t shape (hb_font_t *font, hb_buffer_t *buffer)
|
|
|
|
{
|
2012-07-17 23:09:29 +02:00
|
|
|
hb_bool_t res = hb_shape_full (font, buffer, features, num_features, shapers);
|
|
|
|
if (normalize_glyphs)
|
|
|
|
hb_buffer_normalize_glyphs (buffer);
|
|
|
|
return res;
|
2011-09-08 22:49:02 +02:00
|
|
|
}
|
|
|
|
|
2012-05-16 05:53:18 +02:00
|
|
|
void shape_closure (const char *text, int text_len,
|
|
|
|
hb_font_t *font, hb_buffer_t *buffer,
|
2012-06-02 18:21:19 +02:00
|
|
|
hb_set_t *glyphs)
|
|
|
|
{
|
2012-05-16 05:53:18 +02:00
|
|
|
hb_buffer_reset (buffer);
|
|
|
|
hb_buffer_add_utf8 (buffer, text, text_len, 0, text_len);
|
|
|
|
setup_buffer (buffer);
|
|
|
|
hb_ot_shape_glyphs_closure (font, buffer, features, num_features, glyphs);
|
|
|
|
}
|
|
|
|
|
2012-11-14 00:33:27 +01:00
|
|
|
/* Buffer properties */
|
2011-08-11 11:54:31 +02:00
|
|
|
const char *direction;
|
|
|
|
const char *language;
|
|
|
|
const char *script;
|
2012-11-14 00:33:27 +01:00
|
|
|
|
|
|
|
/* Buffer flags */
|
|
|
|
hb_bool_t bot;
|
|
|
|
hb_bool_t eot;
|
|
|
|
hb_bool_t preserve_default_ignorables;
|
|
|
|
|
2011-08-11 11:54:31 +02:00
|
|
|
hb_feature_t *features;
|
|
|
|
unsigned int num_features;
|
|
|
|
char **shapers;
|
2012-04-17 00:08:20 +02:00
|
|
|
hb_bool_t utf8_clusters;
|
2012-07-17 23:09:29 +02:00
|
|
|
hb_bool_t normalize_glyphs;
|
2013-04-11 22:31:01 +02:00
|
|
|
unsigned int num_iterations;
|
2011-09-13 19:30:39 +02:00
|
|
|
};
|
2011-08-11 11:54:31 +02:00
|
|
|
|
2011-09-08 22:00:04 +02:00
|
|
|
|
2011-09-13 19:30:39 +02:00
|
|
|
struct font_options_t : option_group_t
|
2011-08-11 11:54:31 +02:00
|
|
|
{
|
2011-09-13 19:30:39 +02:00
|
|
|
font_options_t (option_parser_t *parser) {
|
|
|
|
font_file = NULL;
|
|
|
|
face_index = 0;
|
|
|
|
|
|
|
|
font = NULL;
|
|
|
|
|
|
|
|
add_options (parser);
|
|
|
|
}
|
|
|
|
~font_options_t (void) {
|
|
|
|
hb_font_destroy (font);
|
2011-08-11 11:54:31 +02:00
|
|
|
}
|
|
|
|
|
2011-09-13 19:30:39 +02:00
|
|
|
void add_options (option_parser_t *parser);
|
|
|
|
|
|
|
|
hb_font_t *get_font (void) const;
|
2011-09-08 23:08:32 +02:00
|
|
|
|
2011-08-11 11:54:31 +02:00
|
|
|
const char *font_file;
|
|
|
|
int face_index;
|
|
|
|
|
2011-09-13 19:30:39 +02:00
|
|
|
private:
|
|
|
|
mutable hb_font_t *font;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct text_options_t : option_group_t
|
|
|
|
{
|
|
|
|
text_options_t (option_parser_t *parser) {
|
2012-11-14 00:12:24 +01:00
|
|
|
text_before = NULL;
|
|
|
|
text_after = NULL;
|
|
|
|
|
2011-09-13 19:30:39 +02:00
|
|
|
text = NULL;
|
|
|
|
text_file = NULL;
|
|
|
|
|
2011-09-16 08:08:36 +02:00
|
|
|
fp = NULL;
|
|
|
|
gs = NULL;
|
2011-09-13 19:30:39 +02:00
|
|
|
text_len = (unsigned int) -1;
|
|
|
|
|
|
|
|
add_options (parser);
|
|
|
|
}
|
|
|
|
~text_options_t (void) {
|
2011-09-16 08:08:36 +02:00
|
|
|
if (gs)
|
2012-06-06 02:35:40 +02:00
|
|
|
g_string_free (gs, true);
|
2011-09-16 08:08:36 +02:00
|
|
|
if (fp)
|
|
|
|
fclose (fp);
|
2011-09-13 19:30:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void add_options (option_parser_t *parser);
|
|
|
|
|
|
|
|
void post_parse (GError **error G_GNUC_UNUSED) {
|
|
|
|
if (text && text_file)
|
|
|
|
g_set_error (error,
|
|
|
|
G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE,
|
2012-05-12 15:54:27 +02:00
|
|
|
"Only one of text and text-file can be set");
|
2011-09-13 19:30:39 +02:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
const char *get_line (unsigned int *len);
|
|
|
|
|
2012-11-14 00:12:24 +01:00
|
|
|
const char *text_before;
|
|
|
|
const char *text_after;
|
|
|
|
|
2011-09-13 19:30:39 +02:00
|
|
|
const char *text;
|
|
|
|
const char *text_file;
|
|
|
|
|
|
|
|
private:
|
2011-09-16 08:08:36 +02:00
|
|
|
FILE *fp;
|
|
|
|
GString *gs;
|
|
|
|
unsigned int text_len;
|
2011-09-13 19:30:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct output_options_t : option_group_t
|
|
|
|
{
|
2012-12-21 22:46:53 +01:00
|
|
|
output_options_t (option_parser_t *parser,
|
|
|
|
const char *supported_formats_ = NULL) {
|
2011-09-13 19:30:39 +02:00
|
|
|
output_file = NULL;
|
|
|
|
output_format = NULL;
|
2012-12-21 22:46:53 +01:00
|
|
|
supported_formats = supported_formats_;
|
2012-12-21 22:01:52 +01:00
|
|
|
explicit_output_format = false;
|
2011-09-13 19:30:39 +02:00
|
|
|
|
2011-09-15 23:52:00 +02:00
|
|
|
fp = NULL;
|
|
|
|
|
2011-09-13 19:30:39 +02:00
|
|
|
add_options (parser);
|
|
|
|
}
|
2011-09-15 23:52:00 +02:00
|
|
|
~output_options_t (void) {
|
2011-09-16 08:08:36 +02:00
|
|
|
if (fp)
|
2011-09-15 23:52:00 +02:00
|
|
|
fclose (fp);
|
|
|
|
}
|
2011-09-13 19:30:39 +02:00
|
|
|
|
|
|
|
void add_options (option_parser_t *parser);
|
|
|
|
|
|
|
|
void post_parse (GError **error G_GNUC_UNUSED)
|
|
|
|
{
|
2012-12-21 22:01:52 +01:00
|
|
|
if (output_format)
|
|
|
|
explicit_output_format = true;
|
|
|
|
|
2011-09-13 19:30:39 +02:00
|
|
|
if (output_file && !output_format) {
|
|
|
|
output_format = strrchr (output_file, '.');
|
|
|
|
if (output_format)
|
|
|
|
output_format++; /* skip the dot */
|
|
|
|
}
|
|
|
|
|
2011-09-15 23:52:00 +02:00
|
|
|
if (output_file && 0 == strcmp (output_file, "-"))
|
|
|
|
output_file = NULL; /* STDOUT */
|
|
|
|
}
|
|
|
|
|
2011-09-16 07:16:41 +02:00
|
|
|
FILE *get_file_handle (void);
|
2011-08-11 11:54:31 +02:00
|
|
|
|
2011-09-13 19:30:39 +02:00
|
|
|
const char *output_file;
|
|
|
|
const char *output_format;
|
2012-12-21 22:46:53 +01:00
|
|
|
const char *supported_formats;
|
2012-12-21 22:01:52 +01:00
|
|
|
bool explicit_output_format;
|
2011-09-15 23:52:00 +02:00
|
|
|
|
|
|
|
mutable FILE *fp;
|
2011-09-13 19:30:39 +02:00
|
|
|
};
|
2011-08-11 11:54:31 +02:00
|
|
|
|
2011-09-19 22:41:17 +02:00
|
|
|
struct format_options_t : option_group_t
|
|
|
|
{
|
|
|
|
format_options_t (option_parser_t *parser) {
|
|
|
|
show_glyph_names = true;
|
|
|
|
show_positions = true;
|
|
|
|
show_clusters = true;
|
2012-01-19 18:32:20 +01:00
|
|
|
show_text = false;
|
|
|
|
show_unicode = false;
|
2012-01-19 18:46:18 +01:00
|
|
|
show_line_num = false;
|
2011-09-19 22:41:17 +02:00
|
|
|
|
|
|
|
add_options (parser);
|
|
|
|
}
|
|
|
|
|
|
|
|
void add_options (option_parser_t *parser);
|
|
|
|
|
2012-01-19 18:46:18 +01:00
|
|
|
void serialize_unicode (hb_buffer_t *buffer,
|
|
|
|
GString *gs);
|
|
|
|
void serialize_glyphs (hb_buffer_t *buffer,
|
|
|
|
hb_font_t *font,
|
2012-11-15 21:14:09 +01:00
|
|
|
hb_buffer_serialize_format_t format,
|
|
|
|
hb_buffer_serialize_flags_t flags,
|
2012-01-19 18:46:18 +01:00
|
|
|
GString *gs);
|
|
|
|
void serialize_line_no (unsigned int line_no,
|
|
|
|
GString *gs);
|
2012-06-02 18:13:08 +02:00
|
|
|
void serialize_buffer_of_text (hb_buffer_t *buffer,
|
|
|
|
unsigned int line_no,
|
|
|
|
const char *text,
|
|
|
|
unsigned int text_len,
|
|
|
|
hb_font_t *font,
|
|
|
|
GString *gs);
|
|
|
|
void serialize_message (unsigned int line_no,
|
|
|
|
const char *msg,
|
|
|
|
GString *gs);
|
|
|
|
void serialize_buffer_of_glyphs (hb_buffer_t *buffer,
|
|
|
|
unsigned int line_no,
|
|
|
|
const char *text,
|
|
|
|
unsigned int text_len,
|
|
|
|
hb_font_t *font,
|
2012-11-15 21:14:09 +01:00
|
|
|
hb_buffer_serialize_format_t output_format,
|
|
|
|
hb_buffer_serialize_flags_t format_flags,
|
2012-06-02 18:13:08 +02:00
|
|
|
GString *gs);
|
2012-01-19 18:46:18 +01:00
|
|
|
|
2011-09-19 22:41:17 +02:00
|
|
|
|
2011-09-20 20:43:55 +02:00
|
|
|
hb_bool_t show_glyph_names;
|
|
|
|
hb_bool_t show_positions;
|
|
|
|
hb_bool_t show_clusters;
|
2012-01-19 18:32:20 +01:00
|
|
|
hb_bool_t show_text;
|
|
|
|
hb_bool_t show_unicode;
|
2012-01-19 18:46:18 +01:00
|
|
|
hb_bool_t show_line_num;
|
2011-09-19 22:41:17 +02:00
|
|
|
};
|
|
|
|
|
2011-08-11 11:54:31 +02:00
|
|
|
|
|
|
|
#endif
|