Back to index

tetex-bin  3.0
Classes | Defines | Functions | Variables
info-utils.h File Reference
#include "nodes.h"
#include "window.h"
#include "search.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  REFERENCE

Defines

#define info_file_label_of_node(n)   info_parse_label (INFO_FILE_LABEL, n)
#define info_next_label_of_node(n)   info_parse_label (INFO_NEXT_LABEL, n)
#define info_up_label_of_node(n)   info_parse_label (INFO_UP_LABEL, n)
#define info_prev_label_of_node(n)

Functions

void info_parse_node (char *string, int newlines_okay)
REFERENCE ** info_menu_of_node (NODE *node)
REFERENCE ** info_xrefs_of_node (NODE *node)
REFERENCE ** info_xrefs (SEARCH_BINDING *binding)
REFERENCEinfo_get_labeled_reference (char *label, REFERENCE **references)
REFERENCE ** info_menu_items (SEARCH_BINDING *binding)
REFERENCE ** info_concatenate_references (REFERENCE **ref1, REFERENCE **ref2)
REFERENCEinfo_copy_reference (REFERENCE *src)
void info_free_references (REFERENCE **references)
void canonicalize_whitespace (char *string)
char * printed_representation (unsigned char character, int hpos)
char * filename_non_directory (char *pathname)
int internal_info_node_p (NODE *node)
void name_internal_node (NODE *node, char *name)
WINDOWget_internal_info_window (char *name)
WINDOWget_window_of_node (NODE *node)
void info_parse_label (char *label, NODE *node)

Variables

int ISO_Latin_p
char * info_parsed_filename
char * info_parsed_nodename

Class Documentation

struct REFERENCE

Definition at line 33 of file info-utils.h.

Class Members
int end
char * filename
char * label
int line_number
char * nodename
int start

Define Documentation

Definition at line 126 of file info-utils.h.

Definition at line 127 of file info-utils.h.

#define info_prev_label_of_node (   n)
Value:
do { \
    info_parse_label (INFO_PREV_LABEL, n); \
    if (!info_parsed_nodename && !info_parsed_filename) \
      info_parse_label (INFO_ALTPREV_LABEL, n); \
  } while (0)

Definition at line 129 of file info-utils.h.

Definition at line 128 of file info-utils.h.


Function Documentation

void canonicalize_whitespace ( char *  string)

Definition at line 431 of file info-utils.c.

{
  register int i, j;
  int len, whitespace_found, whitespace_loc = 0;
  char *temp;

  if (!string)
    return;

  len = strlen (string);
  temp = (char *)xmalloc (1 + len);

  /* Search for sequences of whitespace or newlines.  Replace all such
     sequences in the string with just a single space. */

  whitespace_found = 0;
  for (i = 0, j = 0; string[i]; i++)
    {
      if (whitespace_or_newline (string[i]))
        {
          whitespace_found++;
          whitespace_loc = i;
          continue;
        }
      else
        {
          if (whitespace_found && whitespace_loc)
            {
              whitespace_found = 0;

              /* Suppress whitespace at start of string. */
              if (j)
                temp[j++] = ' ';
            }

          temp[j++] = string[i];
        }
    }

  /* Kill trailing whitespace. */
  if (j && whitespace (temp[j - 1]))
    j--;

  temp[j] = '\0';
  strcpy (string, temp);
  free (temp);
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* filename_non_directory ( char *  pathname)

Definition at line 633 of file info-utils.c.

{
  register char *filename = pathname + strlen (pathname);

  if (HAVE_DRIVE (pathname))
    pathname += 2;

  while (filename > pathname && !IS_SLASH (filename[-1]))
    filename--;

  return (filename);
}

Here is the call graph for this function:

Here is the caller graph for this function:

WINDOW* get_internal_info_window ( char *  name)

Definition at line 678 of file info-utils.c.

{
  WINDOW *win;

  for (win = windows; win; win = win->next)
    if (internal_info_node_p (win->node) &&
        (strcmp (win->node->nodename, name) == 0))
      break;

  return (win);
}

Here is the call graph for this function:

Definition at line 692 of file info-utils.c.

{
  WINDOW *win = (WINDOW *)NULL;

  for (win = windows; win; win = win->next)
    if (win->node == node)
      break;

  return (win);
}

Here is the caller graph for this function:

Definition at line 351 of file info-utils.c.

{
  register int i, j;
  REFERENCE **result;
  int size;

  /* With one argument passed as NULL, simply return the other arg. */
  if (!ref1)
    return (ref2);
  else if (!ref2)
    return (ref1);

  /* Get the total size of the slots that we will need. */
  for (i = 0; ref1[i]; i++);
  size = i;
  for (i = 0; ref2[i]; i++);
  size += i;

  result = (REFERENCE **)xmalloc ((1 + size) * sizeof (REFERENCE *));

  /* Copy the contents over. */
  for (i = 0; ref1[i]; i++)
    result[i] = ref1[i];

  j = i;
  for (i = 0; ref2[i]; i++)
    result[j++] = ref2[i];

  result[j] = (REFERENCE *)NULL;
  free (ref1);
  free (ref2);
  return (result);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 391 of file info-utils.c.

{
  REFERENCE *dest = xmalloc (sizeof (REFERENCE));
  dest->label = src->label ? xstrdup (src->label) : NULL;
  dest->filename = src->filename ? xstrdup (src->filename) : NULL;
  dest->nodename = src->nodename ? xstrdup (src->nodename) : NULL;
  dest->start = src->start;
  dest->end = src->end;
  
  return dest;
}

Here is the call graph for this function:

void info_free_references ( REFERENCE **  references)

Definition at line 407 of file info-utils.c.

{
  register int i;
  REFERENCE *entry;

  if (references)
    {
      for (i = 0; references && (entry = references[i]); i++)
        {
          maybe_free (entry->label);
          maybe_free (entry->filename);
          maybe_free (entry->nodename);

          free (entry);
        }

      free (references);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

REFERENCE* info_get_labeled_reference ( char *  label,
REFERENCE **  references 
)

Definition at line 334 of file info-utils.c.

{
  register int i;
  REFERENCE *entry;

  for (i = 0; references && (entry = references[i]); i++)
    {
      if (strcmp (label, entry->label) == 0)
        return (entry);
    }
  return ((REFERENCE *)NULL);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 223 of file info-utils.c.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 172 of file info-utils.c.

{
  long position;
  SEARCH_BINDING tmp_search;
  REFERENCE **menu = (REFERENCE **)NULL;

  tmp_search.buffer = node->contents;
  tmp_search.start = 0;
  tmp_search.end = node->nodelen;
  tmp_search.flags = S_FoldCase;

  /* Find the start of the menu. */
  position = search_forward (INFO_MENU_LABEL, &tmp_search);

  if (position == -1)
    return ((REFERENCE **) NULL);

  /* We have the start of the menu now.  Glean menu items from the rest
     of the node. */
  tmp_search.start = position + strlen (INFO_MENU_LABEL);
  tmp_search.start += skip_line (tmp_search.buffer + tmp_search.start);
  tmp_search.start--;
  menu = info_menu_items (&tmp_search);
  return (menu);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void info_parse_label ( char *  label,
NODE node 
)

Definition at line 142 of file info-utils.c.

{
  register int i;
  char *nodeline;

  /* Default answer to failure. */
  save_nodename ((char *)NULL);
  save_filename ((char *)NULL);

  /* Find the label in the first line of this node. */
  nodeline = node->contents;
  i = string_in_line (label, nodeline);

  if (i == -1)
    return;

  nodeline += i;
  nodeline += skip_whitespace (nodeline);
  info_parse_node (nodeline, DONT_SKIP_NEWLINES);
}

Here is the call graph for this function:

void info_parse_node ( char *  string,
int  newlines_okay 
)

Definition at line 60 of file info-utils.c.

{
  register int i = 0;

  /* Default the answer. */
  save_filename ((char *)NULL);
  save_nodename ((char *)NULL);

  /* Special case of nothing passed.  Return nothing. */
  if (!string || !*string)
    return;

  string += skip_whitespace (string);

  /* Check for (FILENAME)NODENAME. */
  if (*string == '(')
    {
      i = 0;
      /* Advance past the opening paren. */
      string++;

      /* Find the closing paren. */
      while (string[i] && string[i] != ')')
        i++;

      /* Remember parsed filename. */
      saven_filename (string, i);

      /* Point directly at the nodename. */
      string += i;

      if (*string)
        string++;
    }

  /* Parse out nodename. */
  i = skip_node_characters (string, newlines_okay);
  saven_nodename (string, i);
  canonicalize_whitespace (info_parsed_nodename);
  if (info_parsed_nodename && !*info_parsed_nodename)
    {
      free (info_parsed_nodename);
      info_parsed_nodename = (char *)NULL;
    }

  /* Parse ``(line ...)'' part of menus, if any.  */
  {
    char *rest = string + i;

    /* Advance only if it's not already at end of string.  */
    if (*rest)
      rest++;

    /* Skip any whitespace first, and then a newline in case the item
       was so long to contain the ``(line ...)'' string in the same
       physical line.  */
    while (whitespace(*rest))
      rest++;
    if (*rest == '\n')
      {
        rest++;
        while (whitespace(*rest))
          rest++;
      }

    /* Are we looking at an opening parenthesis?  That can only mean
       we have a winner. :)  */
    if (strncmp (rest, "(line ", strlen ("(line ")) == 0)
      {
        rest += strlen ("(line ");
        info_parsed_line_number = strtol (rest, NULL, 0);
      }
    else
      info_parsed_line_number = 0;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 232 of file info-utils.c.

{
  return (info_references_internal (INFO_XREF_LABEL, binding));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 202 of file info-utils.c.

{
  SEARCH_BINDING tmp_search;

#if defined (HANDLE_MAN_PAGES)
  if (node->flags & N_IsManPage)
    return (xrefs_of_manpage (node));
#endif

  tmp_search.buffer = node->contents;
  tmp_search.start = 0;
  tmp_search.end = node->nodelen;
  tmp_search.flags = S_FoldCase;

  return (info_xrefs (&tmp_search));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 648 of file info-utils.c.

{
#if defined (NEVER)
  if (node &&
      (node->filename && !*node->filename) &&
      !node->parent && node->nodename)
    return (1);
  else
    return (0);
#else
  return ((node != (NODE *)NULL) && ((node->flags & N_IsInternal) != 0));
#endif /* !NEVER */
}

Here is the caller graph for this function:

void name_internal_node ( NODE node,
char *  name 
)

Definition at line 664 of file info-utils.c.

{
  if (!node)
    return;

  node->filename = "";
  node->parent = (char *)NULL;
  node->nodename = name;
  node->flags |= N_IsInternal;
}

Here is the caller graph for this function:

char* printed_representation ( unsigned char  character,
int  hpos 
)

Definition at line 485 of file info-utils.c.

{
  register int i = 0;
  int printable_limit = ISO_Latin_p ? 255 : 127;

  if (raw_escapes_p && character == '\033')
    the_rep[i++] = character;
  /* Show CTRL-x as ^X.  */
  else if (iscntrl (character) && character < 127)
    {
      switch (character)
        {
        case '\r':
        case '\n':
          the_rep[i++] = character;
          break;

        case '\t':
          {
            int tw;

            tw = ((hpos + 8) & 0xf8) - hpos;
            while (i < tw)
              the_rep[i++] = ' ';
          }
          break;

        default:
          the_rep[i++] = '^';
          the_rep[i++] = (character | 0x40);
        }
    }
  /* Show META-x as 0370.  */
  else if (character > printable_limit)
    {
      sprintf (the_rep + i, "\\%0o", character);
      i = strlen (the_rep);
    }
  else if (character == DEL)
    {
      the_rep[i++] = '^';
      the_rep[i++] = '?';
    }
  else
    the_rep[i++] = character;

  the_rep[i] = 0;

  return the_rep;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 34 of file info-utils.c.

Definition at line 38 of file info-utils.c.

Definition at line 30 of file info-utils.c.