TokenUtils 2.27 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
/* Copyright 1997 Acorn Computers Ltd
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
15 16 17 18 19 20 21 22 23 24
/***************************************************/
/* File   : TokenUtils.h                           */
/*                                                 */
/* Purpose: Utility functions for finding out      */
/*          information about tokens.              */
/*                                                 */
/* Author : A.D.Hodgkinson                         */
/*                                                 */
/* History: 09-Apr-97: Created.                    */
/***************************************************/
25 26 27 28 29 30 31 32 33 34 35 36 37

/* Structures */

typedef struct token_path
{
  int              line;   /* Parent line of the table  */
  int              chunk;  /* Parent chunk of the table */
  table_headdata * head;   /* Pointer to the stream     */
}
token_path;

/* Function prototypes */

38 39 40 41 42
void            tokenutils_anchor_range       (browser_data * b, HStream * token, HStream ** first, HStream ** last);
int             tokenutils_line_range         (browser_data * b, HStream * token, int * fline, int * fchunk, int * lline, int * lchunk, token_path ** path);
int             tokenutils_find_ancestor_line (browser_data * b, HStream * t);
void            tokenutils_find_token         (browser_data * b, reformat_cell * d, HStream * token, int * fline, int * fchunk, int * lline, int * lchunk);
reformat_cell * tokenutils_find_cell          (reformat_cell * cell, int depth, token_path * path);
43

44
void            tokenutils_token_offset       (browser_data * b, token_path * path, int * offset_x, int * offset_y);
45
reformat_cell * tokenutils_token_cell         (browser_data * b, HStream * token);
46
int             tokenutils_within_distance    (browser_data * b, HStream * t1, HStream * t2, int distance);