1 /* 2 * $LynxId: LYJustify.h,v 1.8 2009/11/21 15:24:48 tom Exp $ 3 * 4 * Justification for lynx - implemented by Vlad Harchev <hvv@hippo.ru> 5 * 11 July 1999 6 */ 7 8 #ifndef LYJUSTIFY_H 9 #define LYJUSTIFY_H 10 11 #include <HTUtils.h> 12 13 #ifdef __cplusplus 14 extern "C" { 15 #endif 16 #ifdef USE_JUSTIFY_ELTS 17 extern BOOL can_justify_here; 18 extern BOOL can_justify_here_saved; 19 20 extern BOOL can_justify_this_line; 21 extern int wait_for_this_stacked_elt; 22 extern BOOL form_in_htext; 23 24 /* this is the element with SGML_EMPTY content, so it won't get on the stack, 25 * so we can't trap it with wait_for_this_stacked_elt 26 */ 27 extern BOOL in_DT; 28 29 /*disabled by default*/ 30 /*#define DEBUG_JUSTIFY*/ 31 #ifdef DEBUG_JUSTIFY 32 extern BOOL can_justify_stack_depth; /* can be 0 or 1 if all code is correct */ 33 34 # define CAN_JUSTIFY_STACK_INC ++can_justify_stack_depth;\ 35 assert(can_justify_stack_depth < 2 && can_justify_stack_depth >=0 ); 36 # define CAN_JUSTIFY_STACK_DEC --can_justify_stack_depth;\ 37 assert(can_justify_stack_depth < 2 && can_justify_stack_depth >=0 ); 38 #else 39 # define CAN_JUSTIFY_STACK_INC /* nothing */ 40 # define CAN_JUSTIFY_STACK_DEC /* nothing */ 41 #endif 42 43 #define CAN_JUSTIFY_PUSH(x) can_justify_here_saved=can_justify_here;\ 44 can_justify_here=(x); CAN_JUSTIFY_STACK_INC 45 #define CAN_JUSTIFY_POP can_justify_here=can_justify_here_saved;\ 46 CAN_JUSTIFY_STACK_INC 47 #define CAN_JUSTIFY_SET(x) can_justify_here=(x); 48 49 /* 50 * This is used to indicate that starting from the current offset in current 51 * line justification can take place (in order the gap between some prefix and 52 * the word not to be enlarged. 53 * For example, when forming OL, 54 * 1.21 foo 55 * ^justification can start here so that gap between 1.21 and "foo" 56 * will not be enlarged. 57 * This is a macro (that uses 'me'). 58 */ 59 #define CAN_JUSTIFY_START mark_justify_start_position(me->text); 60 #define CANT_JUSTIFY_THIS_LINE can_justify_this_line = FALSE 61 #define EMIT_IFDEF_USE_JUSTIFY_ELTS(x) x 62 /*defined in order not to wrap single line of code into #ifdef/#endif */ 63 64 extern void ht_justify_cleanup(void); 65 extern void mark_justify_start_position(void *text); 66 67 #else /* ! USE_JUSTIFY_ELTS */ 68 /* 69 * define empty macros so that they can be used without wrapping them in 70 * #ifdef USE_JUSTIFY_ELTS/#endif 71 */ 72 #define CAN_JUSTIFY_PUSH(x) 73 #define CAN_JUSTIFY_POP 74 #define CAN_JUSTIFY_SET(x) 75 #define CAN_JUSTIFY_START 76 #define CANT_JUSTIFY_THIS_LINE 77 #define EMIT_IFDEF_USE_JUSTIFY_ELTS(x) 78 #endif /* USE_JUSTIFY_ELTS */ 79 #define CAN_JUSTIFY_PUSH_F CAN_JUSTIFY_PUSH(FALSE) 80 #ifdef __cplusplus 81 } 82 #endif 83 #endif /* LYJUSTIFY_H */ 84