Ignore:
Timestamp:
2012-02-28T13:59:00+13:00 (12 years ago)
Author:
kjdon
Message:

merged 64_bit_Greenstone branch into trunk, rev 25139

Location:
main/trunk/greenstone2/common-src/indexers/mg/lib
Files:
40 edited
1 copied

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/common-src/indexers/mg/lib/Makefile.in

    r22070 r25147  
    3434AR = ar
    3535CC = @CC@
    36 CFLAGS = @CFLAGS@ @COMPAT32BITFLAGS@ -fpic
     36CFLAGS = @CFLAGS@ -fpic
    3737DEFS = @DEFS@
    3838RANLIB = @RANLIB@
     
    4141# Uncomment for compiling for the nzdl project
    4242#
    43 CFLAGS = @CFLAGS@ @COMPAT32BITFLAGS@ -DQUIET -fpic
     43CFLAGS = @CFLAGS@ -DQUIET -fpic
    4444##########################################
    4545
  • main/trunk/greenstone2/common-src/indexers/mg/lib/bitio_gen.c

    r16583 r25147  
    2828int fprintf (FILE *, const char *,...);
    2929
    30 unsigned long
    31 BIO_Unary_Length (unsigned long val)
     30mg_u_long
     31BIO_Unary_Length (mg_u_long val)
    3232{
    33   register unsigned long num;
     33  register mg_u_long num;
    3434  UNARY_LENGTH (val, num);
    3535  return (num);
     
    3737
    3838
    39 unsigned long
    40 BIO_Binary_Length (unsigned long val, unsigned long b)
     39mg_u_long
     40BIO_Binary_Length (mg_u_long val, mg_u_long b)
    4141{
    42   register unsigned long num;
     42  register mg_u_long num;
    4343  BINARY_LENGTH (val, b, num);
    4444  return (num);
     
    4646
    4747
    48 unsigned long
    49 BIO_Gamma_Length (unsigned long val)
     48mg_u_long
     49BIO_Gamma_Length (mg_u_long val)
    5050{
    51   register unsigned long num;
     51  register mg_u_long num;
    5252  GAMMA_LENGTH (val, num);
    5353  return (num);
     
    5555
    5656
    57 unsigned long
    58 BIO_Delta_Length (unsigned long val)
     57mg_u_long
     58BIO_Delta_Length (mg_u_long val)
    5959{
    60   register unsigned long num;
     60  register mg_u_long num;
    6161  DELTA_LENGTH (val, num);
    6262  return (num);
     
    6464
    6565
    66 unsigned long
    67 BIO_Elias_Length (unsigned long val, unsigned long b, double s)
     66mg_u_long
     67BIO_Elias_Length (mg_u_long val, mg_u_long b, double s)
    6868{
    69   register unsigned long num;
     69  register mg_u_long num;
    7070  ELIAS_LENGTH (val, b, s, num);
    7171  return (num);
    7272}
    7373
    74 unsigned long
    75 BIO_Bblock_Length (unsigned long val, unsigned long b)
     74mg_u_long
     75BIO_Bblock_Length (mg_u_long val, mg_u_long b)
    7676{
    77   register unsigned long num;
     77  register mg_u_long num;
    7878  BBLOCK_LENGTH (val, b, num);
    7979  return (num);
  • main/trunk/greenstone2/common-src/indexers/mg/lib/bitio_gen.h

    r16583 r25147  
    3333#define H_BITIO_GEN
    3434
    35 unsigned long BIO_Unary_Length (unsigned long val);
     35mg_u_long BIO_Unary_Length (mg_u_long val);
    3636
    37 unsigned long BIO_Binary_Length (unsigned long val, unsigned long b);
     37mg_u_long BIO_Binary_Length (mg_u_long val, mg_u_long b);
    3838
    39 unsigned long BIO_Gamma_Length (unsigned long val);
     39mg_u_long BIO_Gamma_Length (mg_u_long val);
    4040
    41 unsigned long BIO_Delta_Length (unsigned long val);
     41mg_u_long BIO_Delta_Length (mg_u_long val);
    4242
    43 unsigned long BIO_Elias_Length (unsigned long val, unsigned long b, double s);
     43mg_u_long BIO_Elias_Length (mg_u_long val, mg_u_long b, double s);
    4444
    45 unsigned long BIO_Bblock_Length (unsigned long val, unsigned long b);
     45mg_u_long BIO_Bblock_Length (mg_u_long val, mg_u_long b);
    4646
    4747int BIO_Bblock_Init (int N, int p);
  • main/trunk/greenstone2/common-src/indexers/mg/lib/bitio_m.h

    r16583 r25147  
    5050#define POSITIVE(f, x)                          \
    5151  if ((x)<=0)                               \
    52     fprintf(stderr,"Error: Cannot "#f" encode %lu\n",(unsigned long)x),exit(1);
     52    fprintf(stderr,"Error: Cannot "#f" encode %d\n",(mg_u_long)x),exit(1);
    5353
    5454
     
    7575#define UNARY_ENCODE(x)                         \
    7676do {                                    \
    77   register unsigned long _B_x = (x);                    \
     77  register mg_u_long _B_x = (x);                    \
    7878  BIO_ENCODE_PROLOGUE;                          \
    7979  POSITIVE(unary, _B_x);                        \
     
    8585#define UNARY_ENCODE_L(x, count)                    \
    8686do {                                    \
    87   register unsigned long _B_x = (x);                    \
     87  register mg_u_long _B_x = (x);                    \
    8888  BIO_ENCODE_PROLOGUE;                          \
    8989  POSITIVE(unary, _B_x);                        \
     
    124124#define BINARY_ENCODE(x, b)                     \
    125125do {                                    \
    126   register unsigned long _B_x = (x);                    \
    127   register unsigned long _B_b = (b);                    \
     126  register mg_u_long _B_x = (x);                    \
     127  register mg_u_long _B_b = (b);                    \
    128128  register int _B_nbits, _B_logofb, _B_thresh;              \
    129129  BIO_ENCODE_PROLOGUE;                          \
     
    145145#define BINARY_ENCODE_L(x, b, count)                    \
    146146do {                                    \
    147   register unsigned long _B_x = (x);                    \
    148   register unsigned long _B_b = (b);                    \
     147  register mg_u_long _B_x = (x);                    \
     148  register mg_u_long _B_b = (b);                    \
    149149  register int _B_nbits, _B_logofb, _B_thresh;              \
    150150  BIO_ENCODE_PROLOGUE;                          \
     
    168168#define BINARY_DECODE(x, b)                     \
    169169do {                                    \
    170   register unsigned long _B_x = 0;                  \
    171   register unsigned long _B_b = (b);                    \
     170  register mg_u_long _B_x = 0;                  \
     171  register mg_u_long _B_b = (b);                    \
    172172  register int _B_i, _B_logofb, _B_thresh;              \
    173173  BIO_DECODE_PROLOGUE;                          \
     
    193193#define BINARY_DECODE_L(x, b, count)                    \
    194194do {                                    \
    195   register unsigned long _B_x = 0;                  \
    196   register unsigned long _B_b = (b);                    \
     195  register mg_u_long _B_x = 0;                  \
     196  register mg_u_long _B_b = (b);                    \
    197197  register int _B_i, _B_logofb, _B_thresh;              \
    198198  BIO_DECODE_PROLOGUE;                          \
     
    220220#define BINARY_LENGTH(x, b, count)                  \
    221221do {                                    \
    222   register unsigned long _B_x = (x);                    \
    223   register unsigned long _B_b = (b);                    \
     222  register mg_u_long _B_x = (x);                    \
     223  register mg_u_long _B_b = (b);                    \
    224224  register int _B_nbits, _B_logofb, _B_thresh;              \
    225225  POSITIVE(binary, _B_x);                       \
     
    240240#define GAMMA_ENCODE(x)                         \
    241241do {                                    \
    242   register unsigned long _B_xx = (x);                   \
     242  register mg_u_long _B_xx = (x);                   \
    243243  register int _B_logofb;                       \
    244244  register int _B_nbits;                        \
     
    255255#define GAMMA_ENCODE_L(x, count)                    \
    256256do {                                    \
    257   register unsigned long _B_xx = (x);                   \
     257  register mg_u_long _B_xx = (x);                   \
    258258  register int _B_logofb;                       \
    259259  register int _B_nbits;                        \
     
    271271#define GAMMA_DECODE(x)                         \
    272272do {                                    \
    273   register unsigned long _B_xx = 1;                 \
     273  register mg_u_long _B_xx = 1;                 \
    274274  register int _B_nbits = 0;                        \
    275275  BIO_DECODE_PROLOGUE;                          \
     
    283283#define GAMMA_DECODE_L(x, count)                    \
    284284do {                                    \
    285   register unsigned long _B_xx = 1;                 \
     285  register mg_u_long _B_xx = 1;                 \
    286286  register int _B_nbits = 0;                        \
    287287  BIO_DECODE_PROLOGUE;                          \
     
    296296#define GAMMA_LENGTH(x, count)                      \
    297297do {                                    \
    298   register unsigned long _B_xx = (x);                   \
     298  register mg_u_long _B_xx = (x);                   \
    299299  register int _B_logofb;                       \
    300300  POSITIVE(gamma, _B_xx);                       \
     
    310310#define DELTA_ENCODE(x)                         \
    311311do {                                    \
    312   register unsigned long _B_xxx = (x);                  \
     312  register mg_u_long _B_xxx = (x);                  \
    313313  register int _B_logx;                         \
    314314  FLOORLOG_2(_B_xxx, _B_logx);                      \
     
    319319#define DELTA_ENCODE_L(x, count)                    \
    320320do {                                    \
    321   register unsigned long _B_xxx = (x);                  \
     321  register mg_u_long _B_xxx = (x);                  \
    322322  register int _B_logx;                         \
    323323  FLOORLOG_2(_B_xxx, _B_logx);                      \
     
    329329#define DELTA_DECODE(x)                         \
    330330do {                                    \
    331   register unsigned long _B_xxx;                    \
     331  register mg_u_long _B_xxx;                    \
    332332  register int _B_logx;                         \
    333333  GAMMA_DECODE(_B_logx); --_B_logx;                 \
     
    338338#define DELTA_DECODE_L(x, count)                    \
    339339do {                                    \
    340   register unsigned long _B_xxx;                    \
     340  register mg_u_long _B_xxx;                    \
    341341  register int _B_logx;                         \
    342342  GAMMA_DECODE_L(_B_logx, count); --_B_logx;                \
     
    347347#define DELTA_LENGTH(x, count)                      \
    348348do {                                    \
    349   register unsigned long _B_xxx = (x);                  \
     349  register mg_u_long _B_xxx = (x);                  \
    350350  register int _B_logx, _B_dcount;                  \
    351351  FLOORLOG_2(_B_xxx, _B_logx);                      \
     
    363363#define ELIAS_ENCODE(x, b, s)                       \
    364364do {                                    \
    365   register unsigned long _B_xx = (x);                   \
    366   register unsigned long _B_b = (b);                    \
     365  register mg_u_long _B_xx = (x);                   \
     366  register mg_u_long _B_b = (b);                    \
    367367  register double _B_s = (s);                       \
    368368  register int _B_lower=1, _B_upper=1;                  \
     
    383383#define ELIAS_ENCODE_L(x, b, s, count)                  \
    384384do {                                    \
    385   register unsigned long _B_xx = (x);                   \
    386   register unsigned long _B_b = (b);                    \
     385  register mg_u_long _B_xx = (x);                   \
     386  register mg_u_long _B_b = (b);                    \
    387387  register double _B_s = (s);                       \
    388388  register int _B_lower=1, _B_upper=1;                  \
     
    403403#define ELIAS_DECODE(x, b, s)                       \
    404404do {                                    \
    405   register unsigned long _B_xx;                     \
    406   register unsigned long _B_b = (b);                    \
     405  register mg_u_long _B_xx;                     \
     406  register mg_u_long _B_b = (b);                    \
    407407  register double _B_s = (s);                       \
    408408  register int _B_lower=1, _B_upper=1;                  \
     
    423423#define ELIAS_DECODE_L(x, b, s, count)                  \
    424424do {                                    \
    425   register unsigned long _B_xx;                     \
    426   register unsigned long _B_b = (b);                    \
     425  register mg_u_long _B_xx;                     \
     426  register mg_u_long _B_b = (b);                    \
    427427  register double _B_s = (s);                       \
    428428  register int _B_lower=1, _B_upper=1;                  \
     
    443443#define ELIAS_LENGTH(x, b, s, count)                    \
    444444do {                                    \
    445   register unsigned long _B_xx = (x);                   \
    446   register unsigned long _B_b = (b);                    \
     445  register mg_u_long _B_xx = (x);                   \
     446  register mg_u_long _B_b = (b);                    \
    447447  register double _B_s = (s);                       \
    448448  register int _B_lower=1, _B_upper=1;                  \
     
    468468#define BBLOCK_ENCODE(x, b)                     \
    469469do {                                    \
    470   register unsigned long _B_xx = (x);                   \
    471   register unsigned long _B_bb = (b);                   \
     470  register mg_u_long _B_xx = (x);                   \
     471  register mg_u_long _B_bb = (b);                   \
    472472  register int _B_xdivb = 0;                        \
    473473  POSITIVE(bblock, _B_xx);                      \
     
    484484#define BBLOCK_ENCODE_L(x, b, count)                    \
    485485do {                                    \
    486   register unsigned long _B_xx = (x);                   \
    487   register unsigned long _B_bb = (b);                   \
     486  register mg_u_long _B_xx = (x);                   \
     487  register mg_u_long _B_bb = (b);                   \
    488488  register int _B_xdivb = 0;                        \
    489489  POSITIVE(bblock, _B_xx);                      \
     
    500500#define BBLOCK_DECODE(x, b)                     \
    501501do {                                    \
    502   register unsigned long _B_x1, _B_xx = 0;              \
    503   register unsigned long _B_bb = (b);                   \
     502  register mg_u_long _B_x1, _B_xx = 0;              \
     503  register mg_u_long _B_bb = (b);                   \
    504504  register int _B_xdivb;                        \
    505505  UNARY_DECODE(_B_xdivb); --_B_xdivb;                   \
     
    512512#define BBLOCK_DECODE_L(x, b, count)                    \
    513513do {                                    \
    514   register unsigned long _B_x1, _B_xx = 0;              \
    515   register unsigned long _B_bb = (b);                   \
     514  register mg_u_long _B_x1, _B_xx = 0;              \
     515  register mg_u_long _B_bb = (b);                   \
    516516  register int _B_xdivb;                        \
    517517  UNARY_DECODE_L(_B_xdivb, count); --_B_xdivb;              \
     
    524524#define BBLOCK_LENGTH(x, b, count)                  \
    525525do {                                    \
    526   register unsigned long _B_bcount, _B_xx = (x);            \
    527   register unsigned long _B_bb = (b);                   \
     526  register mg_u_long _B_bcount, _B_xx = (x);            \
     527  register mg_u_long _B_bb = (b);                   \
    528528  register int _B_xdivb = 0;                        \
    529529  POSITIVE(bblock, _B_xx);                      \
  • main/trunk/greenstone2/common-src/indexers/mg/lib/bitio_m_mems.h

    r16583 r25147  
    3636  {
    3737    unsigned char *Base;
    38     unsigned long pos;
     38    mg_u_long pos;
    3939  }
    4040mems_bitio_state;
     
    4444  {                                 \
    4545    register unsigned char *__base = b;                 \
    46     register unsigned long __pos = p;
     46    register mg_u_long __pos = p;
    4747
    4848#define ENCODE_CONTINUE(b)                      \
    4949  {                                 \
    5050    register unsigned char *__base = (b).Base;              \
    51     register unsigned long __pos = (b).pos;
     51    register mg_u_long __pos = (b).pos;
    5252
    5353#define ENCODE_BIT(b)                           \
     
    7676  {                                 \
    7777    register unsigned char *__base = b;                 \
    78     register unsigned long __pos = p;
     78    register mg_u_long __pos = p;
    7979
    8080#define DECODE_CONTINUE(b)                      \
    8181  {                                 \
    8282    register unsigned char *__base = (b).Base;              \
    83     register unsigned long __pos = (b).pos;
     83    register mg_u_long __pos = (b).pos;
    8484
    8585#define DECODE_ADD_FF(b)                        \
  • main/trunk/greenstone2/common-src/indexers/mg/lib/bitio_m_random.h

    r16583 r25147  
    3838    FILE *File;
    3939    unsigned char *Buf;
    40     unsigned long Base;
    41     unsigned long Used;
    42     unsigned long pos;
    43     unsigned long len;
    44     unsigned long sft;
     40    mg_u_long Base;
     41    mg_u_long Used;
     42    mg_u_long pos;
     43    mg_u_long len;
     44    mg_u_long sft;
    4545  }
    4646random_bitio_state;
     
    5151    register FILE *__file = f;                      \
    5252    register unsigned char *__buf;                  \
    53     register unsigned long __pos = 0;                   \
    54     register unsigned long __base = 0;                  \
    55     register unsigned long __is_used = 0;                   \
    56     register unsigned long __len = (l)-1;               \
    57     register unsigned long __sft = 0;                   \
     53    register mg_u_long __pos = 0;                   \
     54    register mg_u_long __base = 0;                  \
     55    register mg_u_long __is_used = 0;                   \
     56    register mg_u_long __len = (l)-1;               \
     57    register mg_u_long __sft = 0;                   \
    5858    while (__len) { ++__sft; __len >>=1; }              \
    5959    __len = 1<<__sft;                           \
     
    6666    register FILE *__file = (b).File;                   \
    6767    register unsigned char *__buf = (b).Buf;                \
    68     register unsigned long __pos = (b).pos;             \
    69     register unsigned long __base = (b).Base;               \
    70     register unsigned long __is_used = (b).Used;                \
    71     register unsigned long __len = (b).len;             \
    72     register unsigned long __sft = (b).sft;
     68    register mg_u_long __pos = (b).pos;             \
     69    register mg_u_long __base = (b).Base;               \
     70    register mg_u_long __is_used = (b).Used;                \
     71    register mg_u_long __len = (b).len;             \
     72    register mg_u_long __sft = (b).sft;
    7373
    7474#define SEEK fprintf(stderr, "Seek to %d\n",__base)
  • main/trunk/greenstone2/common-src/indexers/mg/lib/bitio_mem.c

    r16583 r25147  
    5555
    5656void
    57 BIO_Mem_Unary_Encode (unsigned long val, mem_bitio_state * bs,
    58               unsigned long *bits)
     57BIO_Mem_Unary_Encode (mg_u_long val, mem_bitio_state * bs,
     58              mg_u_long *bits)
    5959{
    6060  ENCODE_CONTINUE (*bs)
     
    6767
    6868
    69 unsigned long
     69mg_u_long
    7070BIO_Mem_Unary_Decode (mem_bitio_state * bs,
    71               unsigned long *bits)
    72 {
    73   register unsigned long val;
     71              mg_u_long *bits)
     72{
     73  register mg_u_long val;
    7474  DECODE_CONTINUE (*bs)
    7575    if (bits)
     
    8888
    8989void
    90 BIO_Mem_Binary_Encode (unsigned long val, unsigned long b,
    91                mem_bitio_state * bs, unsigned long *bits)
     90BIO_Mem_Binary_Encode (mg_u_long val, mg_u_long b,
     91               mem_bitio_state * bs, mg_u_long *bits)
    9292{
    9393  ENCODE_CONTINUE (*bs)
     
    100100
    101101
    102 unsigned long
    103 BIO_Mem_Binary_Decode (unsigned long b, mem_bitio_state * bs,
    104                unsigned long *bits)
    105 {
    106   register unsigned long val;
     102mg_u_long
     103BIO_Mem_Binary_Decode (mg_u_long b, mem_bitio_state * bs,
     104               mg_u_long *bits)
     105{
     106  register mg_u_long val;
    107107  DECODE_CONTINUE (*bs)
    108108    if (bits)
     
    121121
    122122void
    123 BIO_Mem_Gamma_Encode (unsigned long val, mem_bitio_state * bs,
    124               unsigned long *bits)
     123BIO_Mem_Gamma_Encode (mg_u_long val, mem_bitio_state * bs,
     124              mg_u_long *bits)
    125125{
    126126  ENCODE_CONTINUE (*bs)
     
    133133
    134134
    135 unsigned long
    136 BIO_Mem_Gamma_Decode (mem_bitio_state * bs, unsigned long *bits)
    137 {
    138   register unsigned long val;
     135mg_u_long
     136BIO_Mem_Gamma_Decode (mem_bitio_state * bs, mg_u_long *bits)
     137{
     138  register mg_u_long val;
    139139  DECODE_CONTINUE (*bs)
    140140    if (bits)
     
    150150
    151151void
    152 BIO_Mem_Delta_Encode (unsigned long val, mem_bitio_state * bs,
    153               unsigned long *bits)
     152BIO_Mem_Delta_Encode (mg_u_long val, mem_bitio_state * bs,
     153              mg_u_long *bits)
    154154{
    155155  ENCODE_CONTINUE (*bs)
     
    162162
    163163
    164 unsigned long
    165 BIO_Mem_Delta_Decode (mem_bitio_state * bs, unsigned long *bits)
    166 {
    167   register unsigned long val;
     164mg_u_long
     165BIO_Mem_Delta_Decode (mem_bitio_state * bs, mg_u_long *bits)
     166{
     167  register mg_u_long val;
    168168  DECODE_CONTINUE (*bs)
    169169    if (bits)
     
    176176
    177177void
    178 BIO_Mem_Elias_Encode (unsigned long val, unsigned long b, double s,
    179               mem_bitio_state * bs, unsigned long *bits)
     178BIO_Mem_Elias_Encode (mg_u_long val, mg_u_long b, double s,
     179              mem_bitio_state * bs, mg_u_long *bits)
    180180{
    181181  ENCODE_CONTINUE (*bs)
     
    188188
    189189
    190 unsigned long
    191 BIO_Mem_Elias_Decode (unsigned long b, double s,
    192               mem_bitio_state * bs, unsigned long *bits)
    193 {
    194   register unsigned long val;
     190mg_u_long
     191BIO_Mem_Elias_Decode (mg_u_long b, double s,
     192              mem_bitio_state * bs, mg_u_long *bits)
     193{
     194  register mg_u_long val;
    195195  DECODE_CONTINUE (*bs)
    196196    if (bits)
     
    203203
    204204void
    205 BIO_Mem_Bblock_Encode (unsigned long val, unsigned long b,
    206                mem_bitio_state * bs, unsigned long *bits)
     205BIO_Mem_Bblock_Encode (mg_u_long val, mg_u_long b,
     206               mem_bitio_state * bs, mg_u_long *bits)
    207207{
    208208  ENCODE_CONTINUE (*bs)
     
    215215
    216216
    217 unsigned long
    218 BIO_Mem_Bblock_Decode (unsigned long b, mem_bitio_state * bs,
    219                unsigned long *bits)
    220 {
    221   register unsigned long val;
     217mg_u_long
     218BIO_Mem_Bblock_Decode (mg_u_long b, mem_bitio_state * bs,
     219               mg_u_long *bits)
     220{
     221  register mg_u_long val;
    222222  DECODE_CONTINUE (*bs)
    223223    if (bits)
     
    230230
    231231void
    232 BIO_Mem_Decode_Seek (unsigned long pos, mem_bitio_state * bs)
     232BIO_Mem_Decode_Seek (mg_u_long pos, mem_bitio_state * bs)
    233233{
    234234  DECODE_CONTINUE (*bs)
  • main/trunk/greenstone2/common-src/indexers/mg/lib/bitio_mem.h

    r16583 r25147  
    6161
    6262
    63 void BIO_Mem_Unary_Encode (unsigned long val, mem_bitio_state * bs,
    64                unsigned long *bits);
    65 unsigned long BIO_Mem_Unary_Decode (mem_bitio_state * bs,
    66                     unsigned long *bits);
     63void BIO_Mem_Unary_Encode (mg_u_long val, mem_bitio_state * bs,
     64               mg_u_long *bits);
     65mg_u_long BIO_Mem_Unary_Decode (mem_bitio_state * bs,
     66                    mg_u_long *bits);
    6767
    6868
    6969
    70 void BIO_Mem_Binary_Encode (unsigned long val, unsigned long b,
    71                 mem_bitio_state * bs, unsigned long *bits);
    72 unsigned long BIO_Mem_Binary_Decode (unsigned long b, mem_bitio_state * bs,
    73                      unsigned long *bits);
     70void BIO_Mem_Binary_Encode (mg_u_long val, mg_u_long b,
     71                mem_bitio_state * bs, mg_u_long *bits);
     72mg_u_long BIO_Mem_Binary_Decode (mg_u_long b, mem_bitio_state * bs,
     73                     mg_u_long *bits);
    7474
    7575
    7676
    77 void BIO_Mem_Gamma_Encode (unsigned long val, mem_bitio_state * bs,
    78                unsigned long *bits);
    79 unsigned long BIO_Mem_Gamma_Decode (mem_bitio_state * bs, unsigned long *bits);
     77void BIO_Mem_Gamma_Encode (mg_u_long val, mem_bitio_state * bs,
     78               mg_u_long *bits);
     79mg_u_long BIO_Mem_Gamma_Decode (mem_bitio_state * bs, mg_u_long *bits);
    8080
    8181
    8282
    83 void BIO_Mem_Delta_Encode (unsigned long val, mem_bitio_state * bs,
    84                unsigned long *bits);
    85 unsigned long BIO_Mem_Delta_Decode (mem_bitio_state * bs, unsigned long *bits);
     83void BIO_Mem_Delta_Encode (mg_u_long val, mem_bitio_state * bs,
     84               mg_u_long *bits);
     85mg_u_long BIO_Mem_Delta_Decode (mem_bitio_state * bs, mg_u_long *bits);
    8686
    8787
    88 void BIO_Mem_Elias_Encode (unsigned long val, unsigned long b, double s,
    89                mem_bitio_state * bs, unsigned long *bits);
    90 unsigned long BIO_Mem_Elias_Decode (unsigned long b, double s,
    91                  mem_bitio_state * bs, unsigned long *bits);
     88void BIO_Mem_Elias_Encode (mg_u_long val, mg_u_long b, double s,
     89               mem_bitio_state * bs, mg_u_long *bits);
     90mg_u_long BIO_Mem_Elias_Decode (mg_u_long b, double s,
     91                 mem_bitio_state * bs, mg_u_long *bits);
    9292
    9393
    94 void BIO_Mem_Bblock_Encode (unsigned long val, unsigned long b,
    95                 mem_bitio_state * bs, unsigned long *bits);
    96 unsigned long BIO_Mem_Bblock_Decode (unsigned long b, mem_bitio_state * bs,
    97                      unsigned long *bits);
     94void BIO_Mem_Bblock_Encode (mg_u_long val, mg_u_long b,
     95                mem_bitio_state * bs, mg_u_long *bits);
     96mg_u_long BIO_Mem_Bblock_Decode (mg_u_long b, mem_bitio_state * bs,
     97                     mg_u_long *bits);
    9898
    9999
    100 void BIO_Mem_Decode_Seek (unsigned long pos, mem_bitio_state * bs);
     100void BIO_Mem_Decode_Seek (mg_u_long pos, mem_bitio_state * bs);
    101101
    102102
  • main/trunk/greenstone2/common-src/indexers/mg/lib/bitio_mems.c

    r16583 r25147  
    3030
    3131void
    32 BIO_Mems_Encode_Start (unsigned char *buf, unsigned long pos,
     32BIO_Mems_Encode_Start (unsigned char *buf, mg_u_long pos,
    3333               mems_bitio_state * bs)
    3434{
     
    4646
    4747void
    48 BIO_Mems_Decode_Start (unsigned char *buf, unsigned long pos,
     48BIO_Mems_Decode_Start (unsigned char *buf, mg_u_long pos,
    4949               mems_bitio_state * bs)
    5050{
     
    5757
    5858void
    59 BIO_Mems_Unary_Encode (unsigned long val, mems_bitio_state * bs,
    60                unsigned long *bits)
     59BIO_Mems_Unary_Encode (mg_u_long val, mems_bitio_state * bs,
     60               mg_u_long *bits)
    6161{
    6262  ENCODE_CONTINUE (*bs)
     
    6969
    7070
    71 unsigned long
     71mg_u_long
    7272BIO_Mems_Unary_Decode (mems_bitio_state * bs,
    73                unsigned long *bits)
    74 {
    75   register unsigned long val;
     73               mg_u_long *bits)
     74{
     75  register mg_u_long val;
    7676  DECODE_CONTINUE (*bs)
    7777    if (bits)
     
    9090
    9191void
    92 BIO_Mems_Binary_Encode (unsigned long val, unsigned long b,
    93             mems_bitio_state * bs, unsigned long *bits)
     92BIO_Mems_Binary_Encode (mg_u_long val, mg_u_long b,
     93            mems_bitio_state * bs, mg_u_long *bits)
    9494{
    9595  ENCODE_CONTINUE (*bs)
     
    102102
    103103
    104 unsigned long
    105 BIO_Mems_Binary_Decode (unsigned long b, mems_bitio_state * bs,
    106             unsigned long *bits)
    107 {
    108   register unsigned long val;
     104mg_u_long
     105BIO_Mems_Binary_Decode (mg_u_long b, mems_bitio_state * bs,
     106            mg_u_long *bits)
     107{
     108  register mg_u_long val;
    109109  DECODE_CONTINUE (*bs)
    110110    if (bits)
     
    123123
    124124void
    125 BIO_Mems_Gamma_Encode (unsigned long val, mems_bitio_state * bs,
    126                unsigned long *bits)
     125BIO_Mems_Gamma_Encode (mg_u_long val, mems_bitio_state * bs,
     126               mg_u_long *bits)
    127127{
    128128  ENCODE_CONTINUE (*bs)
     
    135135
    136136
    137 unsigned long
    138 BIO_Mems_Gamma_Decode (mems_bitio_state * bs, unsigned long *bits)
    139 {
    140   register unsigned long val;
     137mg_u_long
     138BIO_Mems_Gamma_Decode (mems_bitio_state * bs, mg_u_long *bits)
     139{
     140  register mg_u_long val;
    141141  DECODE_CONTINUE (*bs)
    142142    if (bits)
     
    152152
    153153void
    154 BIO_Mems_Delta_Encode (unsigned long val, mems_bitio_state * bs,
    155                unsigned long *bits)
     154BIO_Mems_Delta_Encode (mg_u_long val, mems_bitio_state * bs,
     155               mg_u_long *bits)
    156156{
    157157  ENCODE_CONTINUE (*bs)
     
    164164
    165165
    166 unsigned long
    167 BIO_Mems_Delta_Decode (mems_bitio_state * bs, unsigned long *bits)
    168 {
    169   register unsigned long val;
     166mg_u_long
     167BIO_Mems_Delta_Decode (mems_bitio_state * bs, mg_u_long *bits)
     168{
     169  register mg_u_long val;
    170170  DECODE_CONTINUE (*bs)
    171171    if (bits)
     
    178178
    179179void
    180 BIO_Mems_Elias_Encode (unsigned long val, unsigned long b, double s,
    181                mems_bitio_state * bs, unsigned long *bits)
     180BIO_Mems_Elias_Encode (mg_u_long val, mg_u_long b, double s,
     181               mems_bitio_state * bs, mg_u_long *bits)
    182182{
    183183  ENCODE_CONTINUE (*bs)
     
    190190
    191191
    192 unsigned long
    193 BIO_Mems_Elias_Decode (unsigned long b, double s,
    194                mems_bitio_state * bs, unsigned long *bits)
    195 {
    196   register unsigned long val;
     192mg_u_long
     193BIO_Mems_Elias_Decode (mg_u_long b, double s,
     194               mems_bitio_state * bs, mg_u_long *bits)
     195{
     196  register mg_u_long val;
    197197  DECODE_CONTINUE (*bs)
    198198    if (bits)
     
    205205
    206206void
    207 BIO_Mems_Bblock_Encode (unsigned long val, unsigned long b,
    208             mems_bitio_state * bs, unsigned long *bits)
     207BIO_Mems_Bblock_Encode (mg_u_long val, mg_u_long b,
     208            mems_bitio_state * bs, mg_u_long *bits)
    209209{
    210210  ENCODE_CONTINUE (*bs)
     
    217217
    218218
    219 unsigned long
    220 BIO_Mems_Bblock_Decode (unsigned long b, mems_bitio_state * bs,
    221             unsigned long *bits)
    222 {
    223   register unsigned long val;
     219mg_u_long
     220BIO_Mems_Bblock_Decode (mg_u_long b, mems_bitio_state * bs,
     221            mg_u_long *bits)
     222{
     223  register mg_u_long val;
    224224  DECODE_CONTINUE (*bs)
    225225    if (bits)
     
    232232
    233233void
    234 BIO_Mems_Decode_Seek (unsigned long pos, mems_bitio_state * bs)
     234BIO_Mems_Decode_Seek (mg_u_long pos, mems_bitio_state * bs)
    235235{
    236236  DECODE_CONTINUE (*bs)
     
    240240
    241241void
    242 BIO_Mems_Encode_Seek (unsigned long pos, mems_bitio_state * bs)
     242BIO_Mems_Encode_Seek (mg_u_long pos, mems_bitio_state * bs)
    243243{
    244244  ENCODE_CONTINUE (*bs)
  • main/trunk/greenstone2/common-src/indexers/mg/lib/bitio_mems.h

    r16583 r25147  
    3838  {
    3939    unsigned char *Base;
    40     unsigned long pos;
     40    mg_u_long pos;
    4141  }
    4242mems_bitio_state;
     
    4646
    4747
    48 void BIO_Mems_Encode_Start (char *buf, unsigned long pos, mems_bitio_state * bs);
     48void BIO_Mems_Encode_Start (char *buf, mg_u_long pos, mems_bitio_state * bs);
    4949void BIO_Mems_Encode_Done (mems_bitio_state * bs);
    5050
    5151
    5252
    53 void BIO_Mems_Decode_Start (void *buf, unsigned long pos, mems_bitio_state * bs);
     53void BIO_Mems_Decode_Start (void *buf, mg_u_long pos, mems_bitio_state * bs);
    5454
    5555
    5656
    57 void BIO_Mems_Unary_Encode (unsigned long val, mems_bitio_state * bs,
    58                 unsigned long *bits);
    59 unsigned long BIO_Mems_Unary_Decode (mems_bitio_state * bs,
    60                      unsigned long *bits);
     57void BIO_Mems_Unary_Encode (mg_u_long val, mems_bitio_state * bs,
     58                mg_u_long *bits);
     59mg_u_long BIO_Mems_Unary_Decode (mems_bitio_state * bs,
     60                     mg_u_long *bits);
    6161
    6262
    6363
    64 void BIO_Mems_Binary_Encode (unsigned long val, unsigned long b,
    65                  mems_bitio_state * bs, unsigned long *bits);
    66 unsigned long BIO_Mems_Binary_Decode (unsigned long b, mems_bitio_state * bs,
    67                       unsigned long *bits);
     64void BIO_Mems_Binary_Encode (mg_u_long val, mg_u_long b,
     65                 mems_bitio_state * bs, mg_u_long *bits);
     66mg_u_long BIO_Mems_Binary_Decode (mg_u_long b, mems_bitio_state * bs,
     67                      mg_u_long *bits);
    6868
    6969
    7070
    71 void BIO_Mems_Gamma_Encode (unsigned long val, mems_bitio_state * bs,
    72                 unsigned long *bits);
    73 unsigned long BIO_Mems_Gamma_Decode (mems_bitio_state * bs, unsigned long *bits);
     71void BIO_Mems_Gamma_Encode (mg_u_long val, mems_bitio_state * bs,
     72                mg_u_long *bits);
     73mg_u_long BIO_Mems_Gamma_Decode (mems_bitio_state * bs, mg_u_long *bits);
    7474
    7575
    7676
    77 void BIO_Mems_Delta_Encode (unsigned long val, mems_bitio_state * bs,
    78                 unsigned long *bits);
    79 unsigned long BIO_Mems_Delta_Decode (mems_bitio_state * bs, unsigned long *bits);
     77void BIO_Mems_Delta_Encode (mg_u_long val, mems_bitio_state * bs,
     78                mg_u_long *bits);
     79mg_u_long BIO_Mems_Delta_Decode (mems_bitio_state * bs, mg_u_long *bits);
    8080
    8181
    82 void BIO_Mems_Elias_Encode (unsigned long val, unsigned long b, double s,
    83                 mems_bitio_state * bs, unsigned long *bits);
    84 unsigned long BIO_Mems_Elias_Decode (unsigned long b, double s,
    85                 mems_bitio_state * bs, unsigned long *bits);
     82void BIO_Mems_Elias_Encode (mg_u_long val, mg_u_long b, double s,
     83                mems_bitio_state * bs, mg_u_long *bits);
     84mg_u_long BIO_Mems_Elias_Decode (mg_u_long b, double s,
     85                mems_bitio_state * bs, mg_u_long *bits);
    8686
    8787
    88 void BIO_Mems_Bblock_Encode (unsigned long val, unsigned long b,
    89                  mems_bitio_state * bs, unsigned long *bits);
    90 unsigned long BIO_Mems_Bblock_Decode (unsigned long b, mems_bitio_state * bs,
    91                       unsigned long *bits);
     88void BIO_Mems_Bblock_Encode (mg_u_long val, mg_u_long b,
     89                 mems_bitio_state * bs, mg_u_long *bits);
     90mg_u_long BIO_Mems_Bblock_Decode (mg_u_long b, mems_bitio_state * bs,
     91                      mg_u_long *bits);
    9292
    9393
    94 void BIO_Mems_Decode_Seek (unsigned long pos, mems_bitio_state * bs);
     94void BIO_Mems_Decode_Seek (mg_u_long pos, mems_bitio_state * bs);
    9595
    9696
  • main/trunk/greenstone2/common-src/indexers/mg/lib/bitio_random.c

    r16583 r25147  
    3030
    3131void
    32 BIO_Random_Start (FILE * f, unsigned long len,
     32BIO_Random_Start (FILE * f, mg_u_long len,
    3333          random_bitio_state * bs)
    3434{
     
    6464
    6565void
    66 BIO_Random_Unary_Encode (unsigned long val, random_bitio_state * bs,
    67              unsigned long *bits)
     66BIO_Random_Unary_Encode (mg_u_long val, random_bitio_state * bs,
     67             mg_u_long *bits)
    6868{
    6969  ENCODE_CONTINUE (*bs)
     
    7676
    7777
    78 unsigned long
     78mg_u_long
    7979BIO_Random_Unary_Decode (random_bitio_state * bs,
    80              unsigned long *bits)
    81 {
    82   register unsigned long val;
     80             mg_u_long *bits)
     81{
     82  register mg_u_long val;
    8383  DECODE_CONTINUE (*bs)
    8484    if (bits)
     
    9797
    9898void
    99 BIO_Random_Binary_Encode (unsigned long val, unsigned long b,
    100               random_bitio_state * bs, unsigned long *bits)
     99BIO_Random_Binary_Encode (mg_u_long val, mg_u_long b,
     100              random_bitio_state * bs, mg_u_long *bits)
    101101{
    102102  ENCODE_CONTINUE (*bs)
     
    109109
    110110
    111 unsigned long
    112 BIO_Random_Binary_Decode (unsigned long b,
     111mg_u_long
     112BIO_Random_Binary_Decode (mg_u_long b,
    113113              random_bitio_state * bs,
    114               unsigned long *bits)
    115 {
    116   register unsigned long val;
     114              mg_u_long *bits)
     115{
     116  register mg_u_long val;
    117117  DECODE_CONTINUE (*bs)
    118118    if (bits)
     
    131131
    132132void
    133 BIO_Random_Gamma_Encode (unsigned long val, random_bitio_state * bs,
    134              unsigned long *bits)
     133BIO_Random_Gamma_Encode (mg_u_long val, random_bitio_state * bs,
     134             mg_u_long *bits)
    135135{
    136136  ENCODE_CONTINUE (*bs)
     
    143143
    144144
    145 unsigned long
     145mg_u_long
    146146BIO_Random_Gamma_Decode (random_bitio_state * bs,
    147              unsigned long *bits)
    148 {
    149   register unsigned long val;
     147             mg_u_long *bits)
     148{
     149  register mg_u_long val;
    150150  DECODE_CONTINUE (*bs)
    151151    if (bits)
     
    161161
    162162void
    163 BIO_Random_Delta_Encode (unsigned long val, random_bitio_state * bs,
    164              unsigned long *bits)
     163BIO_Random_Delta_Encode (mg_u_long val, random_bitio_state * bs,
     164             mg_u_long *bits)
    165165{
    166166  ENCODE_CONTINUE (*bs)
     
    173173
    174174
    175 unsigned long
     175mg_u_long
    176176BIO_Random_Delta_Decode (random_bitio_state * bs,
    177              unsigned long *bits)
    178 {
    179   register unsigned long val;
     177             mg_u_long *bits)
     178{
     179  register mg_u_long val;
    180180  DECODE_CONTINUE (*bs)
    181181    if (bits)
     
    188188
    189189void
    190 BIO_Random_Elias_Encode (unsigned long val, unsigned long b, double s,
    191              random_bitio_state * bs, unsigned long *bits)
     190BIO_Random_Elias_Encode (mg_u_long val, mg_u_long b, double s,
     191             random_bitio_state * bs, mg_u_long *bits)
    192192{
    193193  ENCODE_CONTINUE (*bs)
     
    200200
    201201
    202 unsigned long
    203 BIO_Random_Elias_Decode (unsigned long b, double s,
     202mg_u_long
     203BIO_Random_Elias_Decode (mg_u_long b, double s,
    204204             random_bitio_state * bs,
    205              unsigned long *bits)
    206 {
    207   register unsigned long val;
     205             mg_u_long *bits)
     206{
     207  register mg_u_long val;
    208208  DECODE_CONTINUE (*bs)
    209209    if (bits)
     
    216216
    217217void
    218 BIO_Random_Bblock_Encode (unsigned long val, unsigned long b,
    219               random_bitio_state * bs, unsigned long *bits)
     218BIO_Random_Bblock_Encode (mg_u_long val, mg_u_long b,
     219              random_bitio_state * bs, mg_u_long *bits)
    220220{
    221221  ENCODE_CONTINUE (*bs)
     
    228228
    229229
    230 unsigned long
    231 BIO_Random_Bblock_Decode (unsigned long b,
     230mg_u_long
     231BIO_Random_Bblock_Decode (mg_u_long b,
    232232              random_bitio_state * bs,
    233               unsigned long *bits)
    234 {
    235   register unsigned long val;
     233              mg_u_long *bits)
     234{
     235  register mg_u_long val;
    236236  DECODE_CONTINUE (*bs)
    237237    if (bits)
     
    244244
    245245void
    246 BIO_Random_Seek (unsigned long pos, random_bitio_state * bs)
     246BIO_Random_Seek (mg_u_long pos, random_bitio_state * bs)
    247247{
    248248  ENCODE_CONTINUE (*bs)
     
    258258}
    259259
    260 unsigned long
     260mg_u_long
    261261BIO_Random_Tell (random_bitio_state * bs)
    262262{
    263   register unsigned long t;
     263  register mg_u_long t;
    264264  ENCODE_CONTINUE (*bs)
    265265    t = ENCODE_TELL;
     
    278278    ((((pos)+7) >> 3) < (mg_ullong)(__base + __len)))
    279279      {
    280     __pos = (long)((pos) - (mg_ullong)(__base << 3));
     280    __pos = (mg_s_long)((pos) - (mg_ullong)(__base << 3));
    281281      }
    282282    else
    283283      {
    284284        ENCODE_FLUSH;
    285     __base = (long)(((pos) >> (__sft+3)) << __sft);
     285    __base = (mg_s_long)(((pos) >> (__sft+3)) << __sft);
    286286   
    287287    fseek(__file,__base,0);
    288288    fread(__buf,1,__len,__file);
    289     __pos = (long)((pos) & ((8 << __sft)-1));
     289    __pos = (mg_s_long)((pos) & ((8 << __sft)-1));
    290290      }
    291291 
  • main/trunk/greenstone2/common-src/indexers/mg/lib/bitio_random.h

    r16583 r25147  
    4343    FILE *File;
    4444    unsigned char *Buf;
    45     unsigned long Base;
    46     unsigned long Used;
    47     unsigned long pos;
    48     unsigned long len;
    49     unsigned long sft;
     45    mg_u_long Base;
     46    mg_u_long Used;
     47    mg_u_long pos;
     48    mg_u_long len;
     49    mg_u_long sft;
    5050  }
    5151random_bitio_state;
     
    5555
    5656
    57 void BIO_Random_Start (FILE * f, unsigned long len,
     57void BIO_Random_Start (FILE * f, mg_u_long len,
    5858               random_bitio_state * bs);
    5959void BIO_Random_Done (random_bitio_state * bs);
     
    6161
    6262
    63 void BIO_Random_Decode_Start (void *buf, unsigned long pos,
     63void BIO_Random_Decode_Start (void *buf, mg_u_long pos,
    6464                  random_bitio_state * bs);
    6565
     
    6969
    7070
    71 void BIO_Random_Unary_Encode (unsigned long val, random_bitio_state * bs,
    72                   unsigned long *bits);
    73 unsigned long BIO_Random_Unary_Decode (random_bitio_state * bs,
    74                        unsigned long *bits);
     71void BIO_Random_Unary_Encode (mg_u_long val, random_bitio_state * bs,
     72                  mg_u_long *bits);
     73mg_u_long BIO_Random_Unary_Decode (random_bitio_state * bs,
     74                       mg_u_long *bits);
    7575
    7676
    7777
    78 void BIO_Random_Binary_Encode (unsigned long val, unsigned long b,
    79                    random_bitio_state * bs, unsigned long *bits);
    80 unsigned long BIO_Random_Binary_Decode (unsigned long b, random_bitio_state * bs,
    81                     unsigned long *bits);
     78void BIO_Random_Binary_Encode (mg_u_long val, mg_u_long b,
     79                   random_bitio_state * bs, mg_u_long *bits);
     80mg_u_long BIO_Random_Binary_Decode (mg_u_long b, random_bitio_state * bs,
     81                    mg_u_long *bits);
    8282
    8383
    8484
    85 void BIO_Random_Gamma_Encode (unsigned long val, random_bitio_state * bs,
    86                   unsigned long *bits);
    87 unsigned long BIO_Random_Gamma_Decode (random_bitio_state * bs,
    88                        unsigned long *bits);
     85void BIO_Random_Gamma_Encode (mg_u_long val, random_bitio_state * bs,
     86                  mg_u_long *bits);
     87mg_u_long BIO_Random_Gamma_Decode (random_bitio_state * bs,
     88                       mg_u_long *bits);
    8989
    9090
    9191
    92 void BIO_Random_Delta_Encode (unsigned long val, random_bitio_state * bs,
    93                   unsigned long *bits);
    94 unsigned long BIO_Random_Delta_Decode (random_bitio_state * bs,
    95                        unsigned long *bits);
     92void BIO_Random_Delta_Encode (mg_u_long val, random_bitio_state * bs,
     93                  mg_u_long *bits);
     94mg_u_long BIO_Random_Delta_Decode (random_bitio_state * bs,
     95                       mg_u_long *bits);
    9696
    9797
    98 void BIO_Random_Elias_Encode (unsigned long val, unsigned long b, double s,
    99                   random_bitio_state * bs, unsigned long *bits);
    100 unsigned long BIO_Random_Elias_Decode (unsigned long b, double s,
     98void BIO_Random_Elias_Encode (mg_u_long val, mg_u_long b, double s,
     99                  random_bitio_state * bs, mg_u_long *bits);
     100mg_u_long BIO_Random_Elias_Decode (mg_u_long b, double s,
    101101                       random_bitio_state * bs,
    102                        unsigned long *bits);
     102                       mg_u_long *bits);
    103103
    104104
    105 void BIO_Random_Bblock_Encode (unsigned long val, unsigned long b,
    106                    random_bitio_state * bs, unsigned long *bits);
    107 unsigned long BIO_Random_Bblock_Decode (unsigned long b,
     105void BIO_Random_Bblock_Encode (mg_u_long val, mg_u_long b,
     106                   random_bitio_state * bs, mg_u_long *bits);
     107mg_u_long BIO_Random_Bblock_Decode (mg_u_long b,
    108108                    random_bitio_state * bs,
    109                     unsigned long *bits);
     109                    mg_u_long *bits);
    110110
    111111
    112 void BIO_Random_Seek (unsigned long pos, random_bitio_state * bs);
     112void BIO_Random_Seek (mg_u_long pos, random_bitio_state * bs);
    113113
    114114void BIO_Random_Flush (random_bitio_state * bs);
    115115
    116 unsigned long BIO_Random_Tell (random_bitio_state * bs);
     116mg_u_long BIO_Random_Tell (random_bitio_state * bs);
    117117
    118118#ifdef USE_LONG_LONG
  • main/trunk/greenstone2/common-src/indexers/mg/lib/bitio_stdio.c

    r16583 r25147  
    7272
    7373void
    74 BIO_Stdio_Unary_Encode (unsigned long val, stdio_bitio_state * bs,
    75             unsigned long *bits)
     74BIO_Stdio_Unary_Encode (mg_u_long val, stdio_bitio_state * bs,
     75            mg_u_long *bits)
    7676{
    7777  ENCODE_CONTINUE (*bs)
     
    8484
    8585
    86 unsigned long
     86mg_u_long
    8787BIO_Stdio_Unary_Decode (stdio_bitio_state * bs,
    88             unsigned long *bits)
    89 {
    90   register unsigned long val;
     88            mg_u_long *bits)
     89{
     90  register mg_u_long val;
    9191  DECODE_CONTINUE (*bs)
    9292    if (bits)
     
    105105
    106106void
    107 BIO_Stdio_Binary_Encode (unsigned long val, unsigned long b,
    108              stdio_bitio_state * bs, unsigned long *bits)
     107BIO_Stdio_Binary_Encode (mg_u_long val, mg_u_long b,
     108             stdio_bitio_state * bs, mg_u_long *bits)
    109109{
    110110  ENCODE_CONTINUE (*bs)
     
    117117
    118118
    119 unsigned long
    120 BIO_Stdio_Binary_Decode (unsigned long b, stdio_bitio_state * bs,
    121              unsigned long *bits)
    122 {
    123   register unsigned long val;
     119mg_u_long
     120BIO_Stdio_Binary_Decode (mg_u_long b, stdio_bitio_state * bs,
     121             mg_u_long *bits)
     122{
     123  register mg_u_long val;
    124124  DECODE_CONTINUE (*bs)
    125125    if (bits)
     
    138138
    139139void
    140 BIO_Stdio_Gamma_Encode (unsigned long val, stdio_bitio_state * bs,
    141             unsigned long *bits)
     140BIO_Stdio_Gamma_Encode (mg_u_long val, stdio_bitio_state * bs,
     141            mg_u_long *bits)
    142142{
    143143  ENCODE_CONTINUE (*bs)
     
    150150
    151151
    152 unsigned long
     152mg_u_long
    153153BIO_Stdio_Gamma_Decode (stdio_bitio_state * bs,
    154             unsigned long *bits)
    155 {
    156   register unsigned long val;
     154            mg_u_long *bits)
     155{
     156  register mg_u_long val;
    157157  DECODE_CONTINUE (*bs)
    158158    if (bits)
     
    168168
    169169void
    170 BIO_Stdio_Delta_Encode (unsigned long val, stdio_bitio_state * bs,
    171             unsigned long *bits)
     170BIO_Stdio_Delta_Encode (mg_u_long val, stdio_bitio_state * bs,
     171            mg_u_long *bits)
    172172{
    173173  ENCODE_CONTINUE (*bs)
     
    180180
    181181
    182 unsigned long
     182mg_u_long
    183183BIO_Stdio_Delta_Decode (stdio_bitio_state * bs,
    184             unsigned long *bits)
    185 {
    186   register unsigned long val;
     184            mg_u_long *bits)
     185{
     186  register mg_u_long val;
    187187  DECODE_CONTINUE (*bs)
    188188    if (bits)
     
    198198
    199199void
    200 BIO_Stdio_Elias_Encode (unsigned long val, unsigned long b, double s,
    201             stdio_bitio_state * bs, unsigned long *bits)
     200BIO_Stdio_Elias_Encode (mg_u_long val, mg_u_long b, double s,
     201            stdio_bitio_state * bs, mg_u_long *bits)
    202202{
    203203  ENCODE_CONTINUE (*bs)
     
    210210
    211211
    212 unsigned long
    213 BIO_Stdio_Elias_Decode (unsigned long b, double s,
     212mg_u_long
     213BIO_Stdio_Elias_Decode (mg_u_long b, double s,
    214214            stdio_bitio_state * bs,
    215             unsigned long *bits)
    216 {
    217   register unsigned long val;
     215            mg_u_long *bits)
     216{
     217  register mg_u_long val;
    218218  DECODE_CONTINUE (*bs)
    219219    if (bits)
     
    228228
    229229void
    230 BIO_Stdio_Bblock_Encode (unsigned long val, unsigned long b,
    231              stdio_bitio_state * bs, unsigned long *bits)
     230BIO_Stdio_Bblock_Encode (mg_u_long val, mg_u_long b,
     231             stdio_bitio_state * bs, mg_u_long *bits)
    232232{
    233233  ENCODE_CONTINUE (*bs)
     
    240240
    241241
    242 unsigned long
    243 BIO_Stdio_Bblock_Decode (unsigned long b, stdio_bitio_state * bs,
    244              unsigned long *bits)
    245 {
    246   register unsigned long val;
     242mg_u_long
     243BIO_Stdio_Bblock_Decode (mg_u_long b, stdio_bitio_state * bs,
     244             mg_u_long *bits)
     245{
     246  register mg_u_long val;
    247247  DECODE_CONTINUE (*bs)
    248248    if (bits)
     
    255255
    256256void
    257 BIO_Stdio_Decode_Seek (unsigned long pos, stdio_bitio_state * bs)
     257BIO_Stdio_Decode_Seek (mg_u_long pos, stdio_bitio_state * bs)
    258258{
    259259  DECODE_CONTINUE (*bs)
  • main/trunk/greenstone2/common-src/indexers/mg/lib/bitio_stdio.h

    r16583 r25147  
    5959
    6060
    61 void BIO_Stdio_Unary_Encode (unsigned long val, stdio_bitio_state * bs,
    62                  unsigned long *bits);
    63 unsigned long BIO_Stdio_Unary_Decode (stdio_bitio_state * bs,
    64                       unsigned long *bits);
     61void BIO_Stdio_Unary_Encode (mg_u_long val, stdio_bitio_state * bs,
     62                 mg_u_long *bits);
     63mg_u_long BIO_Stdio_Unary_Decode (stdio_bitio_state * bs,
     64                      mg_u_long *bits);
    6565
    6666
    6767
    68 void BIO_Stdio_Binary_Encode (unsigned long val, unsigned long b,
    69                   stdio_bitio_state * bs, unsigned long *bits);
    70 unsigned long BIO_Stdio_Binary_Decode (unsigned long b, stdio_bitio_state * bs,
    71                        unsigned long *bits);
     68void BIO_Stdio_Binary_Encode (mg_u_long val, mg_u_long b,
     69                  stdio_bitio_state * bs, mg_u_long *bits);
     70mg_u_long BIO_Stdio_Binary_Decode (mg_u_long b, stdio_bitio_state * bs,
     71                       mg_u_long *bits);
    7272
    7373
    7474
    75 void BIO_Stdio_Gamma_Encode (unsigned long val, stdio_bitio_state * bs,
    76                  unsigned long *bits);
    77 unsigned long BIO_Stdio_Gamma_Decode (stdio_bitio_state * bs,
    78                       unsigned long *bits);
     75void BIO_Stdio_Gamma_Encode (mg_u_long val, stdio_bitio_state * bs,
     76                 mg_u_long *bits);
     77mg_u_long BIO_Stdio_Gamma_Decode (stdio_bitio_state * bs,
     78                      mg_u_long *bits);
    7979
    8080
    8181
    82 void BIO_Stdio_Delta_Encode (unsigned long val, stdio_bitio_state * bs,
    83                  unsigned long *bits);
    84 unsigned long BIO_Stdio_Delta_Decode (stdio_bitio_state * bs,
    85                       unsigned long *bits);
     82void BIO_Stdio_Delta_Encode (mg_u_long val, stdio_bitio_state * bs,
     83                 mg_u_long *bits);
     84mg_u_long BIO_Stdio_Delta_Decode (stdio_bitio_state * bs,
     85                      mg_u_long *bits);
    8686
    8787
    8888
    89 void BIO_Stdio_Elias_Encode (unsigned long val, unsigned long b, double s,
    90                  stdio_bitio_state * bs, unsigned long *bits);
    91 unsigned long BIO_Stdio_Elias_Decode (unsigned long b, double s,
     89void BIO_Stdio_Elias_Encode (mg_u_long val, mg_u_long b, double s,
     90                 stdio_bitio_state * bs, mg_u_long *bits);
     91mg_u_long BIO_Stdio_Elias_Decode (mg_u_long b, double s,
    9292                      stdio_bitio_state * bs,
    93                       unsigned long *bits);
     93                      mg_u_long *bits);
    9494
    9595
    96 void BIO_Stdio_Bblock_Encode (unsigned long val, unsigned long b,
    97                   stdio_bitio_state * bs, unsigned long *bits);
    98 unsigned long BIO_Stdio_Bblock_Decode (unsigned long b, stdio_bitio_state * bs,
    99                        unsigned long *bits);
     96void BIO_Stdio_Bblock_Encode (mg_u_long val, mg_u_long b,
     97                  stdio_bitio_state * bs, mg_u_long *bits);
     98mg_u_long BIO_Stdio_Bblock_Decode (mg_u_long b, stdio_bitio_state * bs,
     99                       mg_u_long *bits);
    100100
    101101
    102 void BIO_Stdio_Decode_Seek (unsigned long pos, stdio_bitio_state * bs);
     102void BIO_Stdio_Decode_Seek (mg_u_long pos, stdio_bitio_state * bs);
    103103
    104104#endif
  • main/trunk/greenstone2/common-src/indexers/mg/lib/filestats.c

    r16583 r25147  
    2828
    2929File *
    30 Fopen (char *name, char *mode, unsigned long magic)
     30Fopen (char *name, char *mode, mg_u_long magic)
    3131{
    3232  FILE *f;
    3333  File *F;
    34   unsigned long m;
     34  mg_u_long m;
    3535  if (!(f = fopen (name, mode)))
    3636    return (NULL);
     
    9090
    9191int
    92 Fseek (File * F, long offset, int ptrname)
     92Fseek (File * F, mg_s_long offset, int ptrname)
    9393{
    9494  int num;
  • main/trunk/greenstone2/common-src/indexers/mg/lib/filestats.h

    r16583 r25147  
    2323#define H_FILESTATS
    2424
     25#include "mglong.h"
    2526
    2627typedef struct FileStats
    2728  {
    28     unsigned long NumSeeks;
    29     unsigned long NumReads;
    30     unsigned long NumBytes;
     29    mg_u_long NumSeeks;
     30    mg_u_long NumReads;
     31    mg_u_long NumBytes;
    3132  }
    3233FileStats;
     
    4546
    4647/* if magic is 0 no magic number is read or written */
    47 File *Fopen (char *name, char *mode, unsigned long magic);
     48File *Fopen (char *name, char *mode, mg_u_long magic);
    4849
    4950size_t Fread (void *ptr, size_t size, size_t nitems, File * F);
    5051
    51 int Fseek (File * F, long offset, int ptrname);
     52int Fseek (File * F, mg_s_long offset, int ptrname);
    5253
    5354void Rewind (File * F);
  • main/trunk/greenstone2/common-src/indexers/mg/lib/gmalloc.c

    r16583 r25147  
    401401{
    402402  __ptr_t result;
    403   unsigned long int adj;
     403  mg_u_long adj;
    404404
    405405  result = (*__morecore) (size);
    406   adj = (unsigned long int) ((unsigned long int) ((char *) result -
     406  adj = (mg_u_long) ((mg_u_long) ((char *) result -
    407407                          (char *) NULL)) % BLOCKSIZE;
    408408  if (adj != 0)
     
    549549      block = BLOCK (result);
    550550      if (--_heapinfo[block].busy.info.frag.nfree != 0)
    551         _heapinfo[block].busy.info.frag.first = (unsigned long int)
    552           ((unsigned long int) ((char *) next->next - (char *) NULL)
     551        _heapinfo[block].busy.info.frag.first = (mg_u_long)
     552          ((mg_u_long) ((char *) next->next - (char *) NULL)
    553553           % BLOCKSIZE) >> log;
    554554
     
    872872      prev = (struct list *) ptr;
    873873      _heapinfo[block].busy.info.frag.nfree = 1;
    874       _heapinfo[block].busy.info.frag.first = (unsigned long int)
    875         ((unsigned long int) ((char *) ptr - (char *) NULL)
     874      _heapinfo[block].busy.info.frag.first = (mg_u_long)
     875        ((mg_u_long) ((char *) ptr - (char *) NULL)
    876876         % BLOCKSIZE >> type);
    877877      prev->next = _fraghead[type].next;
     
    12841284{
    12851285  __ptr_t result;
    1286   unsigned long int adj;
     1286  mg_u_long int adj;
    12871287
    12881288  size = ((size + alignment - 1) / alignment) * alignment;
     
    12911291  if (result == NULL)
    12921292    return NULL;
    1293   adj = (unsigned long int) ((unsigned long int) ((char *) result -
     1293  adj = (mg_u_long) ((mg_u_long) ((char *) result -
    12941294                          (char *) NULL)) % alignment;
    12951295  if (adj != 0)
  • main/trunk/greenstone2/common-src/indexers/mg/lib/huffman.c

    r16583 r25147  
    3030 */
    3131huff_data *
    32 Generate_Huffman_Data (int num, long *freqs, huff_data * data,
    33                u_long * mem)
     32Generate_Huffman_Data (int num, mg_s_long *freqs, huff_data * data,
     33               mg_u_long * mem)
    3434{
    3535  int HNum, i, count;
    36   unsigned long *heap;
     36  mg_u_long *heap;
    3737  huff_data *hd = data;
    3838  if (!hd)
     
    7373      if (heap[heap[curr - 1]] > heap[heap[child - 1]])
    7474        {
    75           register u_long temp;
     75          register mg_u_long temp;
    7676          temp = heap[child - 1];
    7777          heap[child - 1] = heap[curr - 1];
     
    141141
    142142  /* Calculate the code lens */
    143   heap[0] = -1UL;
     143  heap[0] = -1;
    144144  heap[1] = 0;
    145145  for (i = 2; i < num * 2; i++)
     
    154154  for (i = 0; i < num; i++)
    155155    {
    156       register u_long codelen = heap[i + num];
     156      register mg_u_long codelen = heap[i + num];
    157157      hd->clens[i] = (char) codelen;
    158158      if (!codelen)
     
    190190}
    191191
    192 unsigned long *
    193 Generate_Huffman_Codes (huff_data * data, u_long * mem)
     192mg_u_long *
     193Generate_Huffman_Codes (huff_data * data, mg_u_long * mem)
    194194{
    195195  int i;
    196   unsigned long *codes;
    197   unsigned long mc[MAX_HUFFCODE_LEN + 1];
     196  mg_u_long *codes;
     197  mg_u_long mc[MAX_HUFFCODE_LEN + 1];
    198198
    199199  if (!data)
     
    212212
    213213
    214 unsigned long **
    215 Generate_Huffman_Vals (huff_data * data, u_long * mem)
     214mg_u_long **
     215Generate_Huffman_Vals (huff_data * data, mg_u_long * mem)
    216216{
    217217  int i;
    218   unsigned long *fcode[MAX_HUFFCODE_LEN + 1];
    219   unsigned long **values;
    220   unsigned long *vals;
     218  mg_u_long *fcode[MAX_HUFFCODE_LEN + 1];
     219  mg_u_long **values;
     220  mg_u_long *vals;
    221221
    222222  if (!data)
     
    224224  if (!(vals = Xmalloc (data->num_codes * sizeof (*vals))))
    225225    return (NULL);
    226   if (!(values = Xmalloc ((MAX_HUFFCODE_LEN + 1) * sizeof (unsigned long *))))
     226  if (!(values = Xmalloc ((MAX_HUFFCODE_LEN + 1) * sizeof (mg_u_long *))))
    227227    {
    228228      free (vals);
     
    230230    }
    231231
    232   bzero ((char *) values, (MAX_HUFFCODE_LEN + 1) * sizeof (unsigned long *));
     232  bzero ((char *) values, (MAX_HUFFCODE_LEN + 1) * sizeof (mg_u_long *));
    233233
    234234  if (mem)
    235235    *mem += data->num_codes * sizeof (*vals) +
    236       (MAX_HUFFCODE_LEN + 1) * sizeof (unsigned long *);
     236      (MAX_HUFFCODE_LEN + 1) * sizeof (mg_u_long *);
    237237
    238238  fcode[0] = values[0] = &vals[0];
     
    249249
    250250double
    251 Calculate_Huffman_Size (int num, long *freqs, long *counts)
     251Calculate_Huffman_Size (int num, mg_s_long *freqs, mg_s_long *counts)
    252252{
    253253  double size = 0;
     
    321321static int
    322322General_Read_Huffman_Data (size_t (*rd) (), void *f,
    323                huff_data * hd, u_long * mem, u_long * disk)
     323               huff_data * hd, mg_u_long * mem, mg_u_long * disk)
    324324{
    325325  if (rd (&hd->num_codes, sizeof (hd->num_codes), 1, f) != 1)
     
    392392
    393393int
    394 Read_Huffman_Data (FILE * f, huff_data * hd, u_long * mem, u_long * disk)
     394Read_Huffman_Data (FILE * f, huff_data * hd, mg_u_long * mem, mg_u_long * disk)
    395395{
    396396  return General_Read_Huffman_Data (fread, f, hd, mem, disk);
     
    401401
    402402int
    403 F_Read_Huffman_Data (File * f, huff_data * hd, u_long * mem, u_long * disk)
     403F_Read_Huffman_Data (File * f, huff_data * hd, mg_u_long * mem, mg_u_long * disk)
    404404{
    405405  return General_Read_Huffman_Data (Fread, f, hd, mem, disk);
  • main/trunk/greenstone2/common-src/indexers/mg/lib/huffman.h

    r16583 r25147  
    3737    int maxcodelen;
    3838    int lencount[MAX_HUFFCODE_LEN + 1];
    39     unsigned long min_code[MAX_HUFFCODE_LEN + 1];
     39    mg_u_long min_code[MAX_HUFFCODE_LEN + 1];
    4040    char *clens;
    4141  }
     
    4343
    4444
    45 huff_data *Generate_Huffman_Data (int num, long *freqs, huff_data * data,
    46                   u_long * mem);
     45huff_data *Generate_Huffman_Data (int num, mg_s_long *freqs, huff_data * data,
     46                  mg_u_long * mem);
    4747
    48 unsigned long *Generate_Huffman_Codes (huff_data * data, u_long * mem);
     48mg_u_long *Generate_Huffman_Codes (huff_data * data, mg_u_long * mem);
    4949
    50 unsigned long **Generate_Huffman_Vals (huff_data * data, u_long * mem);
     50mg_u_long **Generate_Huffman_Vals (huff_data * data, mg_u_long * mem);
    5151
    5252int Write_Huffman_Data (FILE * f, huff_data * hd);
    5353
    54 int Read_Huffman_Data (FILE * f, huff_data * hd, u_long * mem, u_long * disk);
     54int Read_Huffman_Data (FILE * f, huff_data * hd, mg_u_long * mem, mg_u_long * disk);
    5555
    56 int F_Read_Huffman_Data (File * f, huff_data * hd, u_long * mem, u_long * disk);
     56int F_Read_Huffman_Data (File * f, huff_data * hd, mg_u_long * mem, mg_u_long * disk);
    5757
    5858/* Calculate the number of bits required to code the data with the
    5959   specified frequencies. Normally freqs and counts should point to
    6060   the same array. */
    61 double Calculate_Huffman_Size (int num, long *freqs, long *counts);
     61double Calculate_Huffman_Size (int num, mg_s_long *freqs, mg_s_long *counts);
    6262
    6363
     
    6767    register int __i;                           \
    6868    register int __clen = (lens)[x];                    \
    69     register unsigned long __code = (codes)[x];             \
     69    register mg_u_long __code = (codes)[x];             \
    7070    for (__i=__clen-1; __i>=0; --__i)                   \
    7171      ENCODE_BIT((__code >> __i) & 1);                  \
     
    8181#define HUFF_DECODE(x, mcodes, values)                  \
    8282  do {                                  \
    83     register unsigned long *__min_code = (mcodes);          \
    84     register unsigned long *__mclen = __min_code;           \
    85     register unsigned long **__values = (values);           \
    86     register unsigned long __code = 0;                  \
     83    register mg_u_long *__min_code = (mcodes);          \
     84    register mg_u_long *__mclen = __min_code;           \
     85    register mg_u_long **__values = (values);           \
     86    register mg_u_long __code = 0;                  \
    8787    do                                  \
    8888      {                                 \
     
    9696#define HUFF_DECODE_L(x, mcodes, values, count)             \
    9797  do {                                  \
    98     register unsigned long *__min_code = (mcodes);          \
    99     register unsigned long *__mclen = __min_code;           \
    100     register unsigned long **__values = (values);           \
    101     register unsigned long __code = 0;                  \
     98    register mg_u_long *__min_code = (mcodes);          \
     99    register mg_u_long *__mclen = __min_code;           \
     100    register mg_u_long **__values = (values);           \
     101    register mg_u_long __code = 0;                  \
    102102    do                                  \
    103103      {                                 \
  • main/trunk/greenstone2/common-src/indexers/mg/lib/huffman_mem.c

    r16583 r25147  
    3030
    3131void
    32 BIO_Mem_Huff_Encode (unsigned long val, unsigned long *codes,
     32BIO_Mem_Huff_Encode (mg_u_long val, mg_u_long *codes,
    3333             char *clens, mem_bitio_state * bs)
    3434{
     
    3838}
    3939
    40 unsigned long
    41 BIO_Mem_Huff_Decode (unsigned long *mincodes,
    42              unsigned long **values, mem_bitio_state * bs)
     40mg_u_long
     41BIO_Mem_Huff_Decode (mg_u_long *mincodes,
     42             mg_u_long **values, mem_bitio_state * bs)
    4343{
    44   unsigned long val;
     44  mg_u_long val;
    4545  DECODE_CONTINUE (*bs)
    4646    HUFF_DECODE (val, mincodes, values);
  • main/trunk/greenstone2/common-src/indexers/mg/lib/huffman_mem.h

    r16583 r25147  
    2525
    2626
    27 void BIO_Mem_Huff_Encode (unsigned long val, unsigned long *codes,
     27void BIO_Mem_Huff_Encode (mg_u_long val, mg_u_long *codes,
    2828              char *clens, mem_bitio_state * bs);
    2929
    30 unsigned long BIO_Mem_Huff_Decode (unsigned long *mincodes,
    31                   unsigned long **values, mem_bitio_state * bs);
     30mg_u_long BIO_Mem_Huff_Decode (mg_u_long *mincodes,
     31                  mg_u_long **values, mem_bitio_state * bs);
    3232
    3333
  • main/trunk/greenstone2/common-src/indexers/mg/lib/huffman_stdio.c

    r16583 r25147  
    3333
    3434void
    35 BIO_Stdio_Huff_Encode (unsigned long val, unsigned long *codes,
     35BIO_Stdio_Huff_Encode (mg_u_long val, mg_u_long *codes,
    3636               char *clens, stdio_bitio_state * bs)
    3737{
     
    4141}
    4242
    43 unsigned long
    44 BIO_Stdio_Huff_Decode (unsigned long *mincodes,
    45                unsigned long **values,
     43mg_u_long
     44BIO_Stdio_Huff_Decode (mg_u_long *mincodes,
     45               mg_u_long **values,
    4646               stdio_bitio_state * bs)
    4747{
    48   unsigned long val;
     48  mg_u_long val;
    4949  DECODE_CONTINUE (*bs)
    5050    HUFF_DECODE (val, mincodes, values);
  • main/trunk/greenstone2/common-src/indexers/mg/lib/huffman_stdio.h

    r16583 r25147  
    2525
    2626
    27 void BIO_Stdio_Huff_Encode (unsigned long val, unsigned long *codes,
     27void BIO_Stdio_Huff_Encode (mg_u_long val, mg_u_long *codes,
    2828                char *clens, stdio_bitio_state * bs);
    2929
    3030
    31 unsigned long BIO_Stdio_Huff_Decode (unsigned long *mincodes,
    32                      unsigned long **values,
     31mg_u_long BIO_Stdio_Huff_Decode (mg_u_long *mincodes,
     32                     mg_u_long **values,
    3333                     stdio_bitio_state * bs);
    3434
  • main/trunk/greenstone2/common-src/indexers/mg/lib/longlong.h

    r16583 r25147  
    2222#ifndef H_LONGLONG
    2323#define H_LONGLONG
     24
     25#include "mglong.h"
    2426
    2527#ifndef __WIN32__
     
    7173
    7274/* Not using GCC, so fall back on plain "long" (32-bit) types */
    73 typedef unsigned long int mg_ullong;
    74 typedef long int mg_llong;
     75typedef uint32_t mg_ullong;
     76typedef int32_t mg_llong;
    7577
    76 #define ULL_FS "lu"
    77 #define LL_FS "ld"
     78#define ULL_FS "u"
     79#define LL_FS "d"
    7880
    7981#endif /* __GNUC__ */
  • main/trunk/greenstone2/common-src/indexers/mg/lib/messages.c

    r16583 r25147  
    2828
    2929
    30 void VOLATILE
     30void
    3131FatalError (int ExitCode, const char *fmt,...)
    3232{
  • main/trunk/greenstone2/common-src/indexers/mg/lib/messages.h

    r16583 r25147  
    3131extern char *msg_prefix;
    3232
    33 void VOLATILE FatalError (int ExitCode, const char *fmt,...);
     33void FatalError (int ExitCode, const char *fmt,...);
    3434
    3535void Message (const char *fmt,...);
  • main/trunk/greenstone2/common-src/indexers/mg/lib/netorder.h

    r22257 r25147  
    1717#define HTOND(d)                                                                                  \
    1818        do {                                                                                      \
    19              unsigned long tmph, tmpl;                                                            \
     19             mg_u_long tmph, tmpl;                                                            \
    2020         bcopy ((char *) &d, (char *) &tmph, sizeof(double) >> 1);                            \
    2121         bcopy ((char *) &d + (sizeof(double) >> 1), (char *) &tmpl, sizeof (double) >> 1);   \
     
    2727#define NTOHD(d)                                                                                  \
    2828        do {                                                                                      \
    29              unsigned long tmph, tmpl;                                                            \
     29             mg_u_long tmph, tmpl;                                                            \
    3030         bcopy ((char *) &d, (char *) &tmph, sizeof(double) >> 1);                            \
    3131         bcopy ((char *) &d + (sizeof(double) >> 1), (char *) &tmpl, sizeof (double) >> 1);   \
     
    3737#define HTOND2(hd, nd)                                                                            \
    3838        do {                                                                                      \
    39              unsigned long tmph, tmpl;                                                            \
     39             mg_u_long tmph, tmpl;                                                            \
    4040         bcopy ((char *) &hd, (char *) &tmph, sizeof(double) >> 1);                           \
    4141         bcopy ((char *) &hd + (sizeof(double) >> 1), (char *) &tmpl, sizeof (double) >> 1);  \
     
    4747#define NTOHD2(nd, hd)                                                                            \
    4848        do {                                                                                      \
    49              unsigned long tmph, tmpl;                                                            \
     49             mg_u_long tmph, tmpl;                                                            \
    5050         bcopy ((char *) &nd, (char *) &tmph, sizeof(double) >> 1);                           \
    5151         bcopy ((char *) &nd + (sizeof(double) >> 1), (char *) &tmpl, sizeof (double) >> 1);  \
     
    5959#define HTONF(f)                                                                   \
    6060        do {                                                                       \
    61              unsigned long tmp;                                                    \
     61             mg_u_long tmp;                                                    \
    6262             bcopy ((char *) &(f), (char *) &tmp, sizeof (float));                 \
    6363             HTONUL (tmp);                                                         \
     
    6666#define NTOHF(f)                                                                   \
    6767        do {                                                                       \
    68              unsigned long tmp;                                                    \
     68             mg_u_long tmp;                                                    \
    6969             bcopy ((char *) &(f), (char *) &tmp, sizeof (float));                 \
    7070         NTOHUL (tmp);                                                         \
     
    7373#define HTONF2(hf, nf)                                                             \
    7474        do {                                                                       \
    75              unsigned long tmp;                                                    \
     75             mg_u_long tmp;                                                    \
    7676             bcopy ((char *) &(hf), (char *) &tmp, sizeof (float));                \
    7777             HTONUL (tmp);                                                         \
     
    8080#define NTOHF2(nf, hf)                                                             \
    8181        do {                                                                       \
    82              unsigned long tmp;                                                    \
     82             mg_u_long tmp;                                                    \
    8383             bcopy ((char *) &(nf), (char *) &tmp, sizeof (float));                \
    8484         NTOHUL (tmp);                                                         \
     
    115115
    116116/* pointers */
    117 #define HTONP(p)          ((p) = (void *) htonl ((unsigned long) p))
    118 #define NTOHP(p)          ((p) = (void *) ntohl ((unsigned long) p))
    119 #define HTONP2(hp, np)    ((np) = (void *) htonl ((unsigned long) hp))
    120 #define NTOHP2(np, hp)    ((hp) = (void *) ntohl ((unsigned long) np))
     117#define HTONP(p)          ((p) = (void *) htonl ((mg_u_long) p))
     118#define NTOHP(p)          ((p) = (void *) ntohl ((mg_u_long) p))
     119#define HTONP2(hp, np)    ((np) = (void *) htonl ((mg_u_long) hp))
     120#define NTOHP2(np, hp)    ((hp) = (void *) ntohl ((mg_u_long) np))
    121121
    122122/* unsigned long */
     
    127127
    128128/* signed long */
    129 #define HTONSL(l)         ((l) = (long) htonl ((unsigned long) (l)))
    130 #define NTOHSL(l)         ((l) = (long) ntohl ((unsigned long) (l)))
    131 #define HTONSL2(hl, nl)   ((nl) = (long) htonl ((unsigned long) (hl)))
    132 #define NTOHSL2(nl, hl)   ((hl) = (long) ntohl ((unsigned long) (nl)))
     129#define HTONSL(l)         ((l) = (mg_s_long) htonl ((mg_u_long) (l)))
     130#define NTOHSL(l)         ((l) = (mg_s_long) ntohl ((mg_u_long) (l)))
     131#define HTONSL2(hl, nl)   ((nl) = (mg_s_long) htonl ((mg_u_long) (hl)))
     132#define NTOHSL2(nl, hl)   ((hl) = (mg_s_long) ntohl ((mg_u_long) (nl)))
    133133
    134134/* unsigned int */
    135 #define HTONUI(i)         ((i) = (unsigned int) htonl ((unsigned long) (i)))
    136 #define NTOHUI(i)         ((i) = (unsigned int) ntohl ((unsigned long) (i)))
    137 #define HTONUI2(hi, ni)   ((ni) = (unsigned int) htonl ((unsigned long) (hi)))
    138 #define NTOHUI2(ni, hi)   ((hi) = (unsigned int) ntohl ((unsigned long) (ni)))
     135#define HTONUI(i)         ((i) = (unsigned int) htonl ((mg_u_long) (i)))
     136#define NTOHUI(i)         ((i) = (unsigned int) ntohl ((mg_u_long) (i)))
     137#define HTONUI2(hi, ni)   ((ni) = (unsigned int) htonl ((mg_u_long) (hi)))
     138#define NTOHUI2(ni, hi)   ((hi) = (unsigned int) ntohl ((mg_u_long) (ni)))
    139139
    140140/* signed int */
    141 #define HTONSI(i)         ((i) = (int) htonl ((unsigned long) (i)))
    142 #define NTOHSI(i)         ((i) = (int) ntohl ((unsigned long) (i)))
    143 #define HTONSI2(hi, ni)   ((ni) = (int) htonl ((unsigned long) (hi)))
    144 #define NTOHSI2(ni, hi)   ((hi) = (int) ntohl ((unsigned long) (ni)))
     141#define HTONSI(i)         ((i) = (int) htonl ((mg_u_long) (i)))
     142#define NTOHSI(i)         ((i) = (int) ntohl ((mg_u_long) (i)))
     143#define HTONSI2(hi, ni)   ((ni) = (int) htonl ((mg_u_long) (hi)))
     144#define NTOHSI2(ni, hi)   ((hi) = (int) ntohl ((mg_u_long) (ni)))
    145145
    146146/* unsigned short */
  • main/trunk/greenstone2/common-src/indexers/mg/lib/perf_hash.c

    r16583 r25147  
    4242
    4343/* Random Number stuff */
    44 static long seed[] = {0, 0};
     44static mg_s_long seed[] = {0, 0};
    4545#define RANDOM() irandm(seed)
    4646#define SEED_RANDOM(the_seed) do{ seed[0] = the_seed; }while(0)
     
    105105
    106106#ifndef STRUCT
    107 static long **tb0, **tb1, **tb2;
     107static mg_s_long **tb0, **tb1, **tb2;
    108108#else
    109109struct tb_entry **tb;
     
    128128{               /* deletes edge e from list of v */
    129129
    130   int b;
    131 
     130  int b, norm_b;
    132131  b = FIRST[v];
    133132  assert (norm (b) != 0);
     
    700699    {
    701700      if (tb0)
    702     if (!(tb0[i] = Xmalloc (sizeof (long) * MAX_L)))
     701    if (!(tb0[i] = Xmalloc (sizeof (mg_s_long) * MAX_L)))
    703702        ok = 0;
    704703      if (tb1)
    705     if (!(tb1[i] = Xmalloc (sizeof (long) * MAX_L)))
     704    if (!(tb1[i] = Xmalloc (sizeof (mg_s_long) * MAX_L)))
    706705        ok = 0;
    707706      if (tb2)
    708     if (!(tb2[i] = Xmalloc (sizeof (long) * MAX_L)))
     707    if (!(tb2[i] = Xmalloc (sizeof (mg_s_long) * MAX_L)))
    709708        ok = 0;
    710709    }
     
    744743
    745744  if (r <= 0)
    746     SEED_RANDOM ((long) time ((time_t *) NULL));
     745    SEED_RANDOM ((mg_s_long) time ((time_t *) NULL));
    747746  else
    748747    SEED_RANDOM (r);
     
    907906    {
    908907      if (phd->tb0)
    909     if (!(phd->tb0[i] = Xmalloc (sizeof (long) * phd->MAX_L)))
     908    if (!(phd->tb0[i] = Xmalloc (sizeof (mg_s_long) * phd->MAX_L)))
    910909        ok = 0;
    911910      if (phd->tb1)
    912     if (!(phd->tb1[i] = Xmalloc (sizeof (long) * phd->MAX_L)))
     911    if (!(phd->tb1[i] = Xmalloc (sizeof (mg_s_long) * phd->MAX_L)))
    913912        ok = 0;
    914913      if (phd->tb2)
    915     if (!(phd->tb2[i] = Xmalloc (sizeof (long) * phd->MAX_L)))
     914    if (!(phd->tb2[i] = Xmalloc (sizeof (mg_s_long) * phd->MAX_L)))
    916915        ok = 0;
    917916    }
     
    951950      int j;
    952951
    953       tot += fread ((char *) phd->tb0[i], sizeof (long), phd->MAX_L, f) *
     952      tot += fread ((char *) phd->tb0[i], sizeof (mg_s_long), phd->MAX_L, f) *
    954953        sizeof (int);
    955       tot += fread ((char *) phd->tb1[i], sizeof (long), phd->MAX_L, f) *
     954      tot += fread ((char *) phd->tb1[i], sizeof (mg_s_long), phd->MAX_L, f) *
    956955        sizeof (int);
    957       tot += fread ((char *) phd->tb2[i], sizeof (long), phd->MAX_L, f) *
     956      tot += fread ((char *) phd->tb2[i], sizeof (mg_s_long), phd->MAX_L, f) *
    958957        sizeof (int);
    959958
  • main/trunk/greenstone2/common-src/indexers/mg/lib/perf_hash.h

    r16583 r25147  
    2323#define H_PERF_HASH
    2424
    25 
    26 
     25#include "mglong.h"
    2726
    2827struct tb_entry
    2928  {
    30     long tb0, tb1, tb2;
     29    mg_s_long tb0, tb1, tb2;
    3130  };
    3231
  • main/trunk/greenstone2/common-src/indexers/mg/lib/random.c

    r16583 r25147  
    3333 *  The table mt[0:127] is defined by mt[i] = 69069 ** (128-i)
    3434 */
    35 
    36 #define MASK ((long) 593970775)
     35#include "random.h"
     36
     37#define MASK ((mg_s_long) 593970775)
    3738/*  or in hex, 23674657 */
    3839
     
    4041/*  i.e. 2 to power -31 */
    4142
    42 static long mt [128] =   {
     43static mg_s_long mt [128] =   {
    4344      902906369,
    4445     2030498053,
     
    172173
    173174double
    174 random (long is [2])
     175random (mg_s_long is [2])
    175176{
    176     long it, leh, nit;
     177    mg_s_long it, leh, nit;
    177178
    178179    it = is [0];
     
    187188    is [0] = it;    is [1] = leh;
    188189    if (leh < 0) leh = ~leh;
    189     return (SCALE * ((long) (leh | 1)));
     190    return (SCALE * ((mg_s_long) (leh | 1)));
    190191}
    191192
    192193
    193194
    194 long
    195 irandm (long is [2])
     195mg_s_long
     196irandm (mg_s_long is [2])
    196197{
    197     long it, leh, nit;
     198    mg_s_long it, leh, nit;
    198199
    199200    it = is [0];
  • main/trunk/greenstone2/common-src/indexers/mg/lib/random.h

    r16583 r25147  
    3636 *  The table mt[0:127] is defined by mt[i] = 69069 ** (128-i)
    3737 */
     38#include "mglong.h"
    3839
    39 double random (long is [2]);
    40 long irandm (long is [2]);
     40double random (mg_s_long is [2]);
     41mg_s_long irandm (mg_s_long is [2]);
    4142
    4243#endif
  • main/trunk/greenstone2/common-src/indexers/mg/lib/regex.c

    r16583 r25147  
    28962896  register char *fastmap = bufp->fastmap;
    28972897  unsigned char *pattern = bufp->buffer;
    2898   unsigned long size = bufp->used;
     2898  mg_u_long size = bufp->used;
    28992899  unsigned char *p = pattern;
    29002900  register unsigned char *pend = pattern + size;
  • main/trunk/greenstone2/common-src/indexers/mg/lib/regex.h

    r16583 r25147  
    292292
    293293    /* Number of bytes to which `buffer' points.  */
    294   unsigned long allocated;
     294  mg_u_long allocated;
    295295
    296296    /* Number of bytes actually used in `buffer'.  */
    297   unsigned long used;   
     297  mg_u_long used;   
    298298
    299299        /* Syntax setting with which the pattern was compiled.  */
  • main/trunk/greenstone2/common-src/indexers/mg/lib/rx.c

    r16583 r25147  
    615615
    616616#ifdef __STDC__
    617 RX_DECL unsigned long
     617RX_DECL mg_u_long
    618618rx_bitset_hash (int size, rx_Bitset b)
    619619#else
    620 RX_DECL unsigned long
     620RX_DECL mg_u_long
    621621rx_bitset_hash (size, b)
    622622     int size;
     
    625625{
    626626  int x;
    627   unsigned long hash = (unsigned long)rx_bitset_hash;
     627  uintptr_t hash = (uintptr_t)rx_bitset_hash;
    628628
    629629  for (x = rx_bitset_numb_subsets(size) - 1; x >= 0; --x)
     
    701701
    702702
    703 static unsigned long rx_hash_masks[4] =
     703static mg_u_long rx_hash_masks[4] =
    704704{
    705705  0x12488421,
     
    714714RX_DECL struct rx_hash_item *
    715715rx_hash_find (struct rx_hash * table,
    716           unsigned long hash,
     716          mg_u_long hash,
    717717          void * value,
    718718          struct rx_hash_rules * rules)
     
    721721rx_hash_find (table, hash, value, rules)
    722722     struct rx_hash * table;
    723      unsigned long hash;
     723     mg_u_long hash;
    724724     void * value;
    725725     struct rx_hash_rules * rules;
     
    728728  rx_hash_eq eq = rules->eq;
    729729  int maskc = 0;
    730   long mask = rx_hash_masks [0];
     730  mg_s_long mask = rx_hash_masks [0];
    731731  int bucket = (hash & mask) % 13;
    732732
     
    755755RX_DECL struct rx_hash_item *
    756756rx_hash_store (struct rx_hash * table,
    757            unsigned long hash,
     757           mg_u_long hash,
    758758           void * value,
    759759           struct rx_hash_rules * rules)
     
    762762rx_hash_store (table, hash, value, rules)
    763763     struct rx_hash * table;
    764      unsigned long hash;
     764     mg_u_long hash;
    765765     void * value;
    766766     struct rx_hash_rules * rules;
     
    769769  rx_hash_eq eq = rules->eq;
    770770  int maskc = 0;
    771   long mask = rx_hash_masks[0];
     771  mg_s_long mask = rx_hash_masks[0];
    772772  int bucket = (hash & mask) % 13;
    773773  int depth = 0;
     
    803803    {
    804804      struct rx_hash_item * them = table->buckets[bucket];
    805       unsigned long newmask = rx_hash_masks[maskc + 1];
     805      mg_u_long newmask = rx_hash_masks[maskc + 1];
    806806      while (them)
    807807        {
     
    855855    {
    856856      struct rx_hash * table = it->table;
    857       unsigned long hash = it->hash;
     857      mg_u_long hash = it->hash;
    858858      int depth = (table->parent
    859859           ? (table->parent->parent
     
    17751775         : (!vb
    17761776        ? 1
    1777         : ((long)a->car < (long)b->car
     1777        : ((intptr_t)a->car < (intptr_t)b->car
    17781778           ? 1
    1779            : ((long)a->car > (long)b->car
     1779           : ((intptr_t)a->car > (intptr_t)b->car
    17801780              ? -1
    17811781              : se_list_cmp ((void *)a->cdr, (void *)b->cdr))))));
     
    18421842#endif
    18431843{
    1844   long hash = (long)car ^ (long)cdr;
     1844  intptr_t hash = (intptr_t)car ^ (intptr_t)cdr;
    18451845  struct rx_se_list template;
    18461846
     
    19551955  template.cdr = set;
    19561956  node = rx_hash_store (memo,
    1957             (((long)state) >> 8) ^ (long)set,
     1957            (((intptr_t)state) >> 8) ^ (intptr_t)set,
    19581958            &template, &nfa_set_hash_rules);
    19591959  if (!node)
     
    22642264RX_DECL int
    22652265rx_compactify_nfa (struct rx *rx,
    2266            void **mem, unsigned long *size)
     2266           void **mem, mg_u_long *size)
    22672267#else
    22682268RX_DECL int
     
    22702270     struct rx *rx;
    22712271     void **mem;
    2272      unsigned long *size;
     2272     mg_u_long *size;
    22732273#endif
    22742274{
     
    22792279  int se_list_consc = count_hash_nodes (&rx->se_list_memo);
    22802280  int nfa_setc = count_hash_nodes (&rx->set_list_memo);
    2281   unsigned long total_size;
     2281  mg_u_long total_size;
    22822282
    22832283  /* This takes place in two stages.   First, the total size of the
     
    24072407          {
    24082408        sp = rx_hash_find (&rx->se_list_memo,
    2409                    (long)sesrc->car ^ (long)sesrc->cdr,
     2409                   (intptr_t)sesrc->car ^ (intptr_t)sesrc->cdr,
    24102410                   sesrc, &se_list_hash_rules);
    24112411        if (sp->binding)
     
    24252425          {
    24262426        sp = rx_hash_find (&rx->set_list_memo,
    2427                    ((((long)destlst->car) >> 8)
    2428                     ^ (long)destlst->cdr),
     2427                   ((((intptr_t)destlst->car) >> 8)
     2428                    ^ (intptr_t)destlst->cdr),
    24292429                   destlst, &nfa_set_hash_rules);
    24302430        if (sp->binding)
     
    27982798    (rx_hash_find
    27992799     (&cache->superset_table,
    2800       (unsigned long)set->car ^ set->id ^ (unsigned long)set->cdr,
     2800      (intptr_t)set->car ^ set->id ^ (intptr_t)set->cdr,
    28012801      (void *)set,
    28022802      &cache->superset_hash_rules),
     
    30563056    = ((struct rx_cache *)
    30573057       ((char *)rules
    3058     - (unsigned long)(&((struct rx_cache *)0)->superset_hash_rules)));
     3058    - (intptr_t)(&((struct rx_cache *)0)->superset_hash_rules)));
    30593059  struct rx_superset * template = (struct rx_superset *)val;
    30603060  struct rx_superset * newset
     
    30883088    = ((struct rx_cache *)
    30893089       ((char *)rules
    3090     - (unsigned long)(&((struct rx_cache *)0)->superset_hash_rules)));
     3090    - (intptr_t)(&((struct rx_cache *)0)->superset_hash_rules)));
    30913091  return ((struct rx_hash *)
    30923092      rx_cache_malloc_or_get (cache,
     
    31073107  struct rx_cache * cache
    31083108    = ((struct rx_cache *)
    3109        (char *)rules - (long)(&((struct rx_cache *)0)->superset_hash_rules));
     3109       (char *)rules - (intptr_t)(&((struct rx_cache *)0)->superset_hash_rules));
    31103110  rx_cache_free (cache, &cache->free_hash, (char *)hash);
    31113111}
     
    32643264    template.id = car->id;
    32653265    hit = rx_hash_store (&cache->superset_table,
    3266              (unsigned long)car ^ car->id ^ (unsigned long)cdr,
     3266             (intptr_t)car ^ car->id ^ (intptr_t)cdr,
    32673267             (void *)&template,
    32683268             &cache->superset_hash_rules);
     
    43324332    return;
    43334333      case r_side_effect:
    4334     if (   ((long)rexp->params.side_effect >= 0)
    4335         && (params [(long)rexp->params.side_effect].se == re_se_backref))
    4336       out[ params [(long)rexp->params.side_effect].op1] = 1;
     4334    if (   ((intptr_t)rexp->params.side_effect >= 0)
     4335        && (params [(intptr_t)rexp->params.side_effect].se == re_se_backref))
     4336      out[ params [(intptr_t)rexp->params.side_effect].op1] = 1;
    43374337    return;
    43384338      }
     
    45164516      case r_side_effect:
    45174517    {
    4518       int se = (long)rexp->params.side_effect;
     4518      int se = (intptr_t)rexp->params.side_effect;
    45194519      if (   (se >= 0)
    45204520          && (   ((enum re_side_effects)params[se].se == re_se_lparen)
     
    45634563      return pointless_if_repeated (node->params.pair.left, params);
    45644564    case r_side_effect:
    4565       switch ((enum re_side_effects) (((long)node->params.side_effect < 0)
    4566           ? (enum re_side_effects) (long) node->params.side_effect
    4567           : (enum re_side_effects)params[(long)node->params.side_effect].se))
     4565      switch ((enum re_side_effects) (((intptr_t)node->params.side_effect < 0)
     4566          ? (enum re_side_effects) (intptr_t) node->params.side_effect
     4567          : (enum re_side_effects)params[(intptr_t)node->params.side_effect].se))
    45684568    {
    45694569    case re_se_try:
     
    45884588    case re_se_backref:
    45894589      return 0;
     4590    case re_se_pushback:
     4591    case re_se_push0:
     4592    case re_se_pushpos:
     4593    case re_se_chkpos:
     4594    case re_se_poppos:
     4595    case re_se_tv:
     4596    case re_floogle_flap:
     4597      return -1;
    45904598    }
    45914599    case r_data:
     
    46374645      case r_side_effect:
    46384646    {
    4639       int se = (long)rexp->params.side_effect;
     4647      int se = (intptr_t)rexp->params.side_effect;
    46404648      if (   in_danger
    46414649          && (se >= 0)
     
    47574765    case r_side_effect:
    47584766      return
    4759     !((long)rexp->params.side_effect > 0
    4760       ? idempotent_complex_se [ params [(long)rexp->params.side_effect].se ]
    4761       : idempotent_se [-(long)rexp->params.side_effect]);
     4767    !((intptr_t)rexp->params.side_effect > 0
     4768      ? idempotent_complex_se [ params [(intptr_t)rexp->params.side_effect].se ]
     4769      : idempotent_se [-(intptr_t)rexp->params.side_effect]);
    47624770     
    47634771    case r_alternate:
     
    48114819
    48124820    case r_side_effect:
    4813       return ((long)rexp->params.side_effect >= 0);
     4821      return ((intptr_t)rexp->params.side_effect >= 0);
    48144822     
    48154823    case r_alternate:
     
    52045212          if (need_sync)
    52055213        {
    5206           int sync_se = paramc;
     5214          intptr_t sync_se = paramc;
    52075215          params = (params
    52085216                ? ((struct re_se_params *)
     
    55525560            handle_close:
    55535561              /* See similar code for backslashed left paren above.  */
    5554               if (COMPILE_STACK_EMPTY)
    5555                 if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)
     5562              if (COMPILE_STACK_EMPTY){
     5563                if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD){
    55565564                  goto normal_char;
    5557                 else
     5565        }
     5566                else{
    55585567                  return REG_ERPAREN;
     5568        }
     5569          }
    55595570
    55605571              /* Since we just checked for an empty stack above, this
     
    55735584                this_group_regnum = COMPILE_STACK_TOP.regnum;
    55745585        {
    5575           int left_se = paramc;
    5576           int right_se = paramc + 1;
     5586          intptr_t left_se = paramc;
     5587          intptr_t right_se = paramc + 1;
    55775588
    55785589          params = (params
     
    56255636        last_expression = &alt->params.pair.right;
    56265637        {
    5627           int sync_se = paramc;
     5638          intptr_t sync_se = paramc;
    56285639
    56295640          params = (params
     
    57425753          /* Otherwise, we have a nontrivial interval. */
    57435754          {
    5744             int iter_se = paramc;
    5745             int end_se = paramc + 1;
     5755            intptr_t iter_se = paramc;
     5756            intptr_t end_se = paramc + 1;
    57465757            params = (params
    57475758                  ? ((struct re_se_params *)
     
    59395950
    59405951          {
    5941         int backref_se = paramc;
     5952        intptr_t backref_se = paramc;
    59425953        params = (params
    59435954              ? ((struct re_se_params *)
     
    60096020 
    60106021  {
    6011     int win_se = paramc;
     6022    intptr_t win_se = paramc;
    60126023    params = (params
    60136024          ? ((struct re_se_params *)
     
    61496160      {
    61506161    void * mem = (void *)rxb->buffer;
    6151     unsigned long size = rxb->allocated;
     6162    mg_u_long size = rxb->allocated;
    61526163    int start_id;
    61536164    char * perm_mem;
     
    67576768  while (list)
    67586769    {
    6759       if ((long)list->car >= 0)
     6770      if ((intptr_t)list->car >= 0)
    67606771    ++x;
    67616772      list = list->cdr;
     
    68126823      for (ai = al - 1; ai >= 0; --ai)
    68136824    {
    6814       while ((long)ap->car < 0)
     6825      while ((intptr_t)ap->car < 0)
    68156826        ap = ap->cdr;
    68166827      av[ai] = ap->car;
     
    68206831      for (bi = bl - 1; bi >= 0; --bi)
    68216832    {
    6822       while ((long)bp->car < 0)
     6833      while ((intptr_t)bp->car < 0)
    68236834        bp = bp->cdr;
    68246835      bv[bi] = bp->car;
  • main/trunk/greenstone2/common-src/indexers/mg/lib/rx.h

    r16583 r25147  
    2222/*  t. lord Wed Sep 23 18:20:57 1992    */
    2323
    24 
    25 
    26 
    27 
    28 
    29 
    30 
     24#include "mglong.h"
    3125
    3226#ifndef RX_WANT_SE_DEFS
     
    9185  struct rx_hash_item * next_same_hash;
    9286  struct rx_hash * table;
    93   unsigned long hash;
     87  mg_u_long hash;
    9488  void * data;
    9589  void * binding;
     
    273267   */
    274268  void * buffer;
    275   unsigned long allocated;
     269  mg_u_long allocated;
    276270
    277271  /* Clients of RX can ask for some extra storage in the space pointed
     
    280274   * at (buffer + allocated - reserved)
    281275   */
    282   unsigned long reserved;
     276  mg_u_long reserved;
    283277
    284278  /* --------- The remaining fields are for internal use only. --------- */
     
    12741268
    12751269  void * buffer;        /* Malloced memory for the nfa. */
    1276   unsigned long allocated;  /* Size of that memory. */
     1270  mg_u_long allocated;  /* Size of that memory. */
    12771271
    12781272  /* Pointer to a fastmap, if any, otherwise zero.  re_search uses
     
    15801574                      rx_Bitset a, rx_Bitset b);
    15811575RX_DECL void rx_bitset_xor (int size, rx_Bitset a, rx_Bitset b);
    1582 RX_DECL unsigned long rx_bitset_hash (int size, rx_Bitset b);
     1576RX_DECL mg_u_long rx_bitset_hash (int size, rx_Bitset b);
    15831577RX_DECL struct rx_hash_item * rx_hash_find (struct rx_hash * table,
    1584                         unsigned long hash,
     1578                        mg_u_long hash,
    15851579                        void * value,
    15861580                        struct rx_hash_rules * rules);
    15871581RX_DECL struct rx_hash_item * rx_hash_store (struct rx_hash * table,
    1588                          unsigned long hash,
     1582                         mg_u_long hash,
    15891583                         void * value,
    15901584                         struct rx_hash_rules * rules);
     
    16371631RX_DECL void rx_delete_epsilon_transitions (struct rx *rx);
    16381632RX_DECL int rx_compactify_nfa (struct rx *rx,
    1639                    void **mem, unsigned long *size);
     1633                   void **mem, mg_u_long *size);
    16401634RX_DECL void rx_release_superset (struct rx *rx,
    16411635                  struct rx_superset *set);
     
    16651659RX_DECL void rx_bitset_revdifference ();
    16661660RX_DECL void rx_bitset_xor ();
    1667 RX_DECL unsigned long rx_bitset_hash ();
     1661RX_DECL mg_u_long rx_bitset_hash ();
    16681662RX_DECL struct rx_hash_item * rx_hash_find ();
    16691663RX_DECL struct rx_hash_item * rx_hash_store ();
     
    22302224
    22312225
    2232 
    22332226/* How many characters in the character set.  */
    22342227#define CHAR_SET_SIZE (1 << CHARBITS)
     
    23442337RX_DECL __inline__ int
    23452338rx_search  (struct re_pattern_buffer * rxb,
    2346         int startpos,
     2339        intptr_t startpos,
    23472340        int range,
    23482341        int stop,
     
    23612354        app_closure, regs, resume_state, save_state)
    23622355     struct re_pattern_buffer * rxb;
    2363      int startpos;
     2356     intptr_t startpos;
    23642357     int range;
    23652358     int stop;
     
    27392732  {
    27402733    enum rx_test_match_entry test_pc;
    2741     int inx;
     2734    intptr_t inx;
    27422735    test_pc = search_state.test_match_resume_pt;
    27432736    if (test_pc == rx_test_start)
     
    28392832            ((struct rx_superstate *)
    28402833             ((char *)this_tr_table
    2841               - ((unsigned long)
     2834              - ((mg_u_long)
    28422835             ((struct rx_superstate *)0)->transitions)));
    28432836         
     
    29042897        ((struct rx_superstate *)
    29052898         ((char *)this_tr_table
    2906           - ((unsigned long)
     2899          - ((uintptr_t)
    29072900         ((struct rx_superstate *)0)->transitions)));
    29082901    }
     
    29112904     * Dispatch that instruction:
    29122905     */
    2913     inx = (int)search_state.ifr->inx;
     2906    inx = (intptr_t)search_state.ifr->inx;
    29142907#ifdef RX_DEBUG_0
    29152908    if (rx_debug_trace)
     
    29492942          while (el)
    29502943        {
    2951           long effect;
    2952           effect = (long)el->car;
     2944          intptr_t effect;
     2945          effect = (intptr_t)el->car;
    29532946          if (effect < 0)
    29542947            {
     
    29902983                = ((struct rx_superstate *)
    29912984                   ((char *)search_state.ifr->data
    2992                 - (long)(((struct rx_superstate *)0)
     2985                - (intptr_t)(((struct rx_superstate *)0)
    29932986                     ->transitions)));
    29942987              goto top_of_cycle;
  • main/trunk/greenstone2/common-src/indexers/mg/lib/sptree.c

    r16583 r25147  
    293293        q->par = p;             \
    294294        q->rght = p->left;          \
    295         if(q->rght)             \
    296             q->rght->par = q;       \
     295        if(q->rght){                \
     296          q->rght->par = q;         \
     297        }                                       \
    297298        p->left = q;                \
    298         if(p->par)              \
    299             if(q == p->par->left)       \
    300                 p->par->left = p;   \
    301             else                \
    302                 p->par->rght = p;   \
     299        if(p->par){             \
     300          if(q == p->par->left){        \
     301            p->par->left = p;           \
     302          }                                     \
     303          else{                 \
     304            p->par->rght = p;           \
     305          }                                     \
     306        }                                       \
    303307    }while(0)
    304308
     
    308312        q->par = p;             \
    309313        q->left = p->rght;          \
    310         if(q->left)             \
    311             q->left->par = q;       \
     314        if(q->left){                \
     315          q->left->par = q;         \
     316        }                                       \
    312317        p->rght = q;                \
    313         if(p->par)              \
    314             if(q == p->par->left)       \
    315                 p->par->left = p;   \
    316             else                \
    317                 p->par->rght = p;   \
     318        if(p->par){             \
     319          if(q == p->par->left){        \
     320            p->par->left = p;           \
     321          }                                     \
     322          else{                             \
     323            p->par->rght = p;           \
     324          }                                     \
     325        }                                       \
    318326    }while(0)
    319327
     
    341349      if (p == q->left)
    342350    {
    343       if (g == NNULL)
     351      if (g == NNULL){
    344352        ROTATER (p, q);
     353      }
    345354      else if (q == g->left)
    346355        {
     
    356365      else
    357366    {
    358       if (g == NNULL)
     367      if (g == NNULL){
    359368        ROTATEL (p, q);
     369      }
    360370      else if (q == g->rght)
    361371        {
  • main/trunk/greenstone2/common-src/indexers/mg/lib/sptree.h

    r16583 r25147  
    2929  {
    3030    int no_of_items;
    31     unsigned long mem_in_use;
     31    mg_u_long mem_in_use;
    3232    int (*cmp) (void *, void *);
    3333    void *root;
  • main/trunk/greenstone2/common-src/indexers/mg/lib/unitool.c

    r23431 r25147  
    1515 * column
    1616 */
    17 unsigned long *unicode_cat_data=NULL;
     17mg_u_long *unicode_cat_data=NULL;
    1818
    1919
     
    14641464 * column
    14651465 */
    1466 unsigned long *unicode_cat_data;
     1466mg_u_long *unicode_cat_data;
    14671467
    14681468void create_unicat_data () {
     
    14701470  int min_start=0;
    14711471  int min_end=0;
    1472   register unsigned long min_value=0; /* filling the whole byte */
     1472  register mg_u_long min_value=0; /* filling the whole byte */
    14731473 
    14741474  const unirange *letter_here = letter_info;
     
    15291529   
    15301530      } else {
    1531     register unsigned long mask = 3 << ((i % 16) * 2);
     1531    register mg_u_long mask = 3 << ((i % 16) * 2);
    15321532    unicode_cat_data[i/16] = (unicode_cat_data[i/16] & (~mask)) |
    15331533                  (min_value & mask);
  • main/trunk/greenstone2/common-src/indexers/mg/lib/win32in.c

    r16583 r25147  
    44/* unix systems. */
    55
    6 unsigned long htonl(unsigned long x) {
     6mg_u_long htonl(mg_u_long x) {
    77#if defined (LITTLE_ENDIAN) || defined (_LITTLE_ENDIAN) || defined(__LITTLE_ENDIAN)
    88    x = ((x >> 24) & 0x000000FF) | ((x >> 8) & 0x0000FF00) |
     
    2525}
    2626
    27 unsigned long ntohl(unsigned long x) {
     27mg_u_long ntohl(mg_u_long x) {
    2828#if defined (LITTLE_ENDIAN) || defined (_LITTLE_ENDIAN) || defined(__LITTLE_ENDIAN)
    2929    x = ((x >> 24) & 0x000000FF) | ((x >> 8) & 0x0000FF00) |
     
    5151
    5252main () {
    53     long x;
     53    mg_s_long x;
    5454    short sx;
    5555
  • main/trunk/greenstone2/common-src/indexers/mg/lib/win32in.h

    r16583 r25147  
    44#include "longlong.h"
    55
    6 unsigned long htonl(unsigned long x);
    7 unsigned long ntohl(unsigned long x);
     6mg_u_long htonl(mg_u_long x);
     7mg_u_long ntohl(mg_u_long x);
    88mg_ullong ntohll(mg_ullong x);
    99unsigned short htons(unsigned short x);
Note: See TracChangeset for help on using the changeset viewer.