home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / word2x0a.zip / source / lib.h < prev    next >
C/C++ Source or Header  |  1998-04-20  |  2KB  |  100 lines

  1. /* $Id: lib.h,v 1.21 1998/02/17 12:27:18 dps Exp $ */
  2.  
  3. #ifndef __word2x_lib_h__
  4. #define __word2x_lib_h__
  5. #include "config.h"
  6. #include <stdio.h>
  7. #include <stddef.h>
  8.  
  9. #ifdef __cplusplus
  10. #include "tblock.h"
  11. #include "interface.h"
  12. #endif /* __cplusplus */
  13.  
  14.  
  15. /* Maximum section number */
  16. #define MAX_START_NUM 100
  17.  
  18. typedef struct
  19. {
  20.     int wd[2];
  21.     int dot_pos;
  22.     int has_sign;
  23. } num_info;
  24.  
  25. typedef enum { ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT, ALIGN_DP } align_t;
  26.  
  27. struct wd_info
  28. {
  29.     int width;
  30.     int dp_col;
  31.     int has_sign;
  32.     align_t align;
  33. };
  34.  
  35. /* Unit information */
  36. struct unit_info
  37. {
  38.     int unit_type;
  39.     int unit_number[NUNITS];
  40. };
  41.  
  42. /* Numbered unit probing */
  43. struct unit_number
  44. {
  45.     int unit_num;
  46.     int offset;
  47. };
  48.  
  49. #ifndef N
  50. #define N(a) (sizeof(a)/sizeof(a[0]))
  51. #endif
  52.  
  53.  
  54. /*
  55.  * Functions that need only C stuff are declared as C linkage here
  56.  */
  57. #ifdef __cplusplus
  58. extern "C" {
  59. #endif
  60.  
  61. extern struct wd_info find_width(int, const char *const *);
  62. extern num_info scan_num(const char *);
  63. extern struct unit_number n_unit_probe(const char *, struct unit_info *);
  64. extern int get_part_num(const char *, const char *);
  65.  
  66. /* Date formats */
  67. #include <time.h>
  68. extern char *uk_date(time_t);
  69. extern char *us_date(time_t);
  70.  
  71. /* Basic stuff for reading numbers from files */
  72. extern unsigned long read_ulong(FILE *);
  73. extern long read_long(FILE *);
  74. extern short read_ushort(FILE *);
  75. extern unsigned short read_short(FILE *);
  76.  
  77. #ifdef __cplusplus
  78. }
  79. #endif
  80.  
  81. #ifdef __cplusplus
  82.  
  83. #ifndef N
  84. #define N(x) (sizeof(x)/sizeof(x[0]))
  85. #endif /* N */
  86. #include "tblock.h"
  87. #include "reader.h"
  88.  
  89. #ifndef __EXCLUDE_READER_CLASSES
  90. extern void null_proc(const tok_seq::tok *, const docfmt *, FILE *, void *);
  91. extern void error_proc(const tok_seq::tok *, const docfmt *, FILE *, void *);
  92. #endif /* __EXCLUDE_READER_CLASSES */
  93. extern tblock *word_wrap(const char *, const char *,const char *, const int,
  94.              const int=0);
  95. extern tblock *__map_string(const char *, const cmap *, int);
  96. #define map_string(a,b) __map_string(a, b, N(b));
  97. #endif /* __cplusplus */
  98.  
  99. #endif /* __word2x_lib_h__ */
  100.