mirror of
https://github.com/postgres/postgres.git
synced 2025-06-14 18:42:34 +03:00
Ye-old pgindent run. Same 4-space tabs.
This commit is contained in:
@ -144,7 +144,7 @@ array_texteq(ArrayType *array, char *value)
|
||||
{
|
||||
return array_iterator((Oid) 25, /* text */
|
||||
(Oid) 67, /* texteq */
|
||||
0, /* logical or */
|
||||
0, /* logical or */
|
||||
array, (Datum) value);
|
||||
}
|
||||
|
||||
@ -153,7 +153,7 @@ array_all_texteq(ArrayType *array, char *value)
|
||||
{
|
||||
return array_iterator((Oid) 25, /* text */
|
||||
(Oid) 67, /* texteq */
|
||||
1, /* logical and */
|
||||
1, /* logical and */
|
||||
array, (Datum) value);
|
||||
}
|
||||
|
||||
@ -162,7 +162,7 @@ array_textregexeq(ArrayType *array, char *value)
|
||||
{
|
||||
return array_iterator((Oid) 25, /* text */
|
||||
(Oid) 1254, /* textregexeq */
|
||||
0, /* logical or */
|
||||
0, /* logical or */
|
||||
array, (Datum) value);
|
||||
}
|
||||
|
||||
@ -171,7 +171,7 @@ array_all_textregexeq(ArrayType *array, char *value)
|
||||
{
|
||||
return array_iterator((Oid) 25, /* text */
|
||||
(Oid) 1254, /* textregexeq */
|
||||
1, /* logical and */
|
||||
1, /* logical and */
|
||||
array, (Datum) value);
|
||||
}
|
||||
|
||||
@ -185,7 +185,7 @@ array_varchareq(ArrayType *array, char *value)
|
||||
{
|
||||
return array_iterator((Oid) 1043, /* varchar */
|
||||
(Oid) 1070, /* varchareq */
|
||||
0, /* logical or */
|
||||
0, /* logical or */
|
||||
array, (Datum) value);
|
||||
}
|
||||
|
||||
@ -194,7 +194,7 @@ array_all_varchareq(ArrayType *array, char *value)
|
||||
{
|
||||
return array_iterator((Oid) 1043, /* varchar */
|
||||
(Oid) 1070, /* varchareq */
|
||||
1, /* logical and */
|
||||
1, /* logical and */
|
||||
array, (Datum) value);
|
||||
}
|
||||
|
||||
@ -203,7 +203,7 @@ array_varcharregexeq(ArrayType *array, char *value)
|
||||
{
|
||||
return array_iterator((Oid) 1043, /* varchar */
|
||||
(Oid) 1254, /* textregexeq */
|
||||
0, /* logical or */
|
||||
0, /* logical or */
|
||||
array, (Datum) value);
|
||||
}
|
||||
|
||||
@ -212,7 +212,7 @@ array_all_varcharregexeq(ArrayType *array, char *value)
|
||||
{
|
||||
return array_iterator((Oid) 1043, /* varchar */
|
||||
(Oid) 1254, /* textregexeq */
|
||||
1, /* logical and */
|
||||
1, /* logical and */
|
||||
array, (Datum) value);
|
||||
}
|
||||
|
||||
@ -226,7 +226,7 @@ array_bpchareq(ArrayType *array, char *value)
|
||||
{
|
||||
return array_iterator((Oid) 1042, /* bpchar */
|
||||
(Oid) 1048, /* bpchareq */
|
||||
0, /* logical or */
|
||||
0, /* logical or */
|
||||
array, (Datum) value);
|
||||
}
|
||||
|
||||
@ -235,7 +235,7 @@ array_all_bpchareq(ArrayType *array, char *value)
|
||||
{
|
||||
return array_iterator((Oid) 1042, /* bpchar */
|
||||
(Oid) 1048, /* bpchareq */
|
||||
1, /* logical and */
|
||||
1, /* logical and */
|
||||
array, (Datum) value);
|
||||
}
|
||||
|
||||
@ -244,7 +244,7 @@ array_bpcharregexeq(ArrayType *array, char *value)
|
||||
{
|
||||
return array_iterator((Oid) 1042, /* bpchar */
|
||||
(Oid) 1254, /* textregexeq */
|
||||
0, /* logical or */
|
||||
0, /* logical or */
|
||||
array, (Datum) value);
|
||||
}
|
||||
|
||||
@ -253,7 +253,7 @@ array_all_bpcharregexeq(ArrayType *array, char *value)
|
||||
{
|
||||
return array_iterator((Oid) 1042, /* bpchar */
|
||||
(Oid) 1254, /* textregexeq */
|
||||
1, /* logical and */
|
||||
1, /* logical and */
|
||||
array, (Datum) value);
|
||||
}
|
||||
|
||||
@ -266,7 +266,7 @@ array_int4eq(ArrayType *array, int4 value)
|
||||
{
|
||||
return array_iterator((Oid) 23, /* int4 */
|
||||
(Oid) 65, /* int4eq */
|
||||
0, /* logical or */
|
||||
0, /* logical or */
|
||||
array, (Datum) value);
|
||||
}
|
||||
|
||||
@ -275,7 +275,7 @@ array_all_int4eq(ArrayType *array, int4 value)
|
||||
{
|
||||
return array_iterator((Oid) 23, /* int4 */
|
||||
(Oid) 65, /* int4eq */
|
||||
1, /* logical and */
|
||||
1, /* logical and */
|
||||
array, (Datum) value);
|
||||
}
|
||||
|
||||
@ -284,7 +284,7 @@ array_int4ne(ArrayType *array, int4 value)
|
||||
{
|
||||
return array_iterator((Oid) 23, /* int4 */
|
||||
(Oid) 144, /* int4ne */
|
||||
0, /* logical or */
|
||||
0, /* logical or */
|
||||
array, (Datum) value);
|
||||
}
|
||||
|
||||
@ -293,7 +293,7 @@ array_all_int4ne(ArrayType *array, int4 value)
|
||||
{
|
||||
return array_iterator((Oid) 23, /* int4 */
|
||||
(Oid) 144, /* int4ne */
|
||||
1, /* logical and */
|
||||
1, /* logical and */
|
||||
array, (Datum) value);
|
||||
}
|
||||
|
||||
@ -302,7 +302,7 @@ array_int4gt(ArrayType *array, int4 value)
|
||||
{
|
||||
return array_iterator((Oid) 23, /* int4 */
|
||||
(Oid) 147, /* int4gt */
|
||||
0, /* logical or */
|
||||
0, /* logical or */
|
||||
array, (Datum) value);
|
||||
}
|
||||
|
||||
@ -311,7 +311,7 @@ array_all_int4gt(ArrayType *array, int4 value)
|
||||
{
|
||||
return array_iterator((Oid) 23, /* int4 */
|
||||
(Oid) 147, /* int4gt */
|
||||
1, /* logical and */
|
||||
1, /* logical and */
|
||||
array, (Datum) value);
|
||||
}
|
||||
|
||||
@ -320,7 +320,7 @@ array_int4ge(ArrayType *array, int4 value)
|
||||
{
|
||||
return array_iterator((Oid) 23, /* int4 */
|
||||
(Oid) 150, /* int4ge */
|
||||
0, /* logical or */
|
||||
0, /* logical or */
|
||||
array, (Datum) value);
|
||||
}
|
||||
|
||||
@ -329,7 +329,7 @@ array_all_int4ge(ArrayType *array, int4 value)
|
||||
{
|
||||
return array_iterator((Oid) 23, /* int4 */
|
||||
(Oid) 150, /* int4ge */
|
||||
1, /* logical and */
|
||||
1, /* logical and */
|
||||
array, (Datum) value);
|
||||
}
|
||||
|
||||
@ -338,7 +338,7 @@ array_int4lt(ArrayType *array, int4 value)
|
||||
{
|
||||
return array_iterator((Oid) 23, /* int4 */
|
||||
(Oid) 66, /* int4lt */
|
||||
0, /* logical or */
|
||||
0, /* logical or */
|
||||
array, (Datum) value);
|
||||
}
|
||||
|
||||
@ -347,7 +347,7 @@ array_all_int4lt(ArrayType *array, int4 value)
|
||||
{
|
||||
return array_iterator((Oid) 23, /* int4 */
|
||||
(Oid) 66, /* int4lt */
|
||||
1, /* logical and */
|
||||
1, /* logical and */
|
||||
array, (Datum) value);
|
||||
}
|
||||
|
||||
@ -356,7 +356,7 @@ array_int4le(ArrayType *array, int4 value)
|
||||
{
|
||||
return array_iterator((Oid) 23, /* int4 */
|
||||
(Oid) 149, /* int4le */
|
||||
0, /* logical or */
|
||||
0, /* logical or */
|
||||
array, (Datum) value);
|
||||
}
|
||||
|
||||
@ -365,7 +365,7 @@ array_all_int4le(ArrayType *array, int4 value)
|
||||
{
|
||||
return array_iterator((Oid) 23, /* int4 */
|
||||
(Oid) 149, /* int4le */
|
||||
1, /* logical and */
|
||||
1, /* logical and */
|
||||
array, (Datum) value);
|
||||
}
|
||||
|
||||
@ -376,7 +376,7 @@ array_oideq(ArrayType *array, Oid value)
|
||||
{
|
||||
return array_iterator((Oid) 26, /* oid */
|
||||
(Oid) 184, /* oideq */
|
||||
0, /* logical or */
|
||||
0, /* logical or */
|
||||
array, (Datum) value);
|
||||
}
|
||||
|
||||
@ -385,7 +385,7 @@ array_all_oidne(ArrayType *array, Oid value)
|
||||
{
|
||||
return array_iterator((Oid) 26, /* int4 */
|
||||
(Oid) 185, /* oidne */
|
||||
1, /* logical and */
|
||||
1, /* logical and */
|
||||
array, (Datum) value);
|
||||
}
|
||||
|
||||
@ -393,8 +393,8 @@ array_all_oidne(ArrayType *array, Oid value)
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* tab-width: 4
|
||||
* c-indent-level: 4
|
||||
* c-basic-offset: 4
|
||||
* tab-width: 4
|
||||
* c-indent-level: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define ARRAY_ITERATOR_H
|
||||
|
||||
static int32 array_iterator(Oid elemtype, Oid proc, int and,
|
||||
ArrayType *array, Datum value);
|
||||
ArrayType *array, Datum value);
|
||||
|
||||
int32 array_texteq(ArrayType *array, char *value);
|
||||
int32 array_all_texteq(ArrayType *array, char *value);
|
||||
@ -32,14 +32,15 @@ int32 array_all_int4lt(ArrayType *array, int4 value);
|
||||
int32 array_int4le(ArrayType *array, int4 value);
|
||||
int32 array_all_int4le(ArrayType *array, int4 value);
|
||||
|
||||
int32 array_oideq(ArrayType *array, Oid value);
|
||||
int32 array_all_oidne(ArrayType *array, Oid value);
|
||||
int32 array_oideq(ArrayType *array, Oid value);
|
||||
int32 array_all_oidne(ArrayType *array, Oid value);
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* tab-width: 4
|
||||
* c-indent-level: 4
|
||||
* c-basic-offset: 4
|
||||
* tab-width: 4
|
||||
* c-indent-level: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
|
1253
contrib/bit/varbit.c
1253
contrib/bit/varbit.c
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <float.h> /* faked on sunos4 */
|
||||
#include <float.h> /* faked on sunos4 */
|
||||
|
||||
#include <math.h>
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
#ifdef HAVE_LIMITS_H
|
||||
#include <limits.h>
|
||||
#ifndef MAXINT
|
||||
#define MAXINT INT_MAX
|
||||
#define MAXINT INT_MAX
|
||||
#endif
|
||||
#else
|
||||
#ifdef HAVE_VALUES_H
|
||||
@ -22,7 +22,7 @@
|
||||
#include "utils/builtins.h"
|
||||
|
||||
|
||||
#define HEXDIG(z) (z)<10 ? ((z)+'0') : ((z)-10+'A')
|
||||
#define HEXDIG(z) (z)<10 ? ((z)+'0') : ((z)-10+'A')
|
||||
|
||||
/* Modeled on struct varlena from postgres.h, bu data type is bits8 */
|
||||
struct varbita
|
||||
@ -49,25 +49,25 @@ struct varbita
|
||||
#define VARBITEND(PTR) ((bits8 *) (PTR + VARSIZE(PTR)))
|
||||
/* Mask that will cover exactly one byte, i.e. BITSPERBYTE bits */
|
||||
#define BITMASK 0xFF
|
||||
#define BITHIGH 0x80
|
||||
#define BITHIGH 0x80
|
||||
|
||||
|
||||
bits8 * zpbitin(char *s, int dummy, int32 atttypmod);
|
||||
char * zpbitout(bits8 *s);
|
||||
char * zpbitsout(bits8 *s);
|
||||
bits8 * varbitin(char *s, int dummy, int32 atttypmod);
|
||||
bool biteq (bits8 *arg1, bits8 *arg2);
|
||||
bool bitne (bits8 *arg1, bits8 *arg2);
|
||||
bool bitge (bits8 *arg1, bits8 *arg2);
|
||||
bool bitgt (bits8 *arg1, bits8 *arg2);
|
||||
bool bitle (bits8 *arg1, bits8 *arg2);
|
||||
bool bitlt (bits8 *arg1, bits8 *arg2);
|
||||
int bitcmp (bits8 *arg1, bits8 *arg2);
|
||||
bits8 * bitand (bits8 * arg1, bits8 * arg2);
|
||||
bits8 * bitor (bits8 * arg1, bits8 * arg2);
|
||||
bits8 * bitxor (bits8 * arg1, bits8 * arg2);
|
||||
bits8 * bitnot (bits8 * arg);
|
||||
bits8 * bitshiftright (bits8 * arg, int shft);
|
||||
bits8 * bitshiftleft (bits8 * arg, int shft);
|
||||
bits8 * bitcat (bits8 *arg1, bits8 *arg2);
|
||||
bits8 * bitsubstr (bits8 *arg, int32 s, int32 l);
|
||||
bits8 *zpbitin(char *s, int dummy, int32 atttypmod);
|
||||
char *zpbitout(bits8 *s);
|
||||
char *zpbitsout(bits8 *s);
|
||||
bits8 *varbitin(char *s, int dummy, int32 atttypmod);
|
||||
bool biteq(bits8 *arg1, bits8 *arg2);
|
||||
bool bitne(bits8 *arg1, bits8 *arg2);
|
||||
bool bitge(bits8 *arg1, bits8 *arg2);
|
||||
bool bitgt(bits8 *arg1, bits8 *arg2);
|
||||
bool bitle(bits8 *arg1, bits8 *arg2);
|
||||
bool bitlt(bits8 *arg1, bits8 *arg2);
|
||||
int bitcmp(bits8 *arg1, bits8 *arg2);
|
||||
bits8 *bitand(bits8 *arg1, bits8 *arg2);
|
||||
bits8 *bitor(bits8 *arg1, bits8 *arg2);
|
||||
bits8 *bitxor(bits8 *arg1, bits8 *arg2);
|
||||
bits8 *bitnot(bits8 *arg);
|
||||
bits8 *bitshiftright(bits8 *arg, int shft);
|
||||
bits8 *bitshiftleft(bits8 *arg, int shft);
|
||||
bits8 *bitcat(bits8 *arg1, bits8 *arg2);
|
||||
bits8 *bitsubstr(bits8 *arg, int32 s, int32 l);
|
||||
|
@ -2,21 +2,23 @@
|
||||
|
||||
#include "varbit.h"
|
||||
|
||||
bits8 * varbit_in (char * s);
|
||||
char * varbit_out (bits8 *s);
|
||||
bits8 *varbit_in(char *s);
|
||||
char *varbit_out(bits8 *s);
|
||||
|
||||
bits8 *
|
||||
varbit_in (char * s) {
|
||||
return varbitin (s, 0, -1);
|
||||
varbit_in(char *s)
|
||||
{
|
||||
return varbitin(s, 0, -1);
|
||||
}
|
||||
|
||||
/*char *
|
||||
/*char *
|
||||
varbit_out (bits8 *s) {
|
||||
return zpbitout(s);
|
||||
}
|
||||
*/
|
||||
|
||||
char *
|
||||
varbit_out (bits8 *s) {
|
||||
return zpbitsout(s);
|
||||
char *
|
||||
varbit_out(bits8 *s)
|
||||
{
|
||||
return zpbitsout(s);
|
||||
}
|
||||
|
@ -2,173 +2,183 @@
|
||||
#include "varbit.h"
|
||||
#include <stdio.h>
|
||||
|
||||
void print_details (unsigned char *s);
|
||||
void print_details(unsigned char *s);
|
||||
|
||||
const int numb = 8;
|
||||
|
||||
const int numb = 8;
|
||||
/*
|
||||
const char *b[] = { "B0010", "B11011011", "B0001", "X3F12", "X27", "B",
|
||||
"X11", "B100111"};
|
||||
"X11", "B100111"};
|
||||
int atttypmod[] = {-1, -1, -1,-1,-1,-1,-1,-1 };
|
||||
*/
|
||||
const char *b[] = { "B0010", "B11011011", "B10001", "X3D12", "X27", "B",
|
||||
"X11", "B100111"};
|
||||
int atttypmod[] = { 7, 9, 6, 18, 11, 6, -1, -1 };
|
||||
const char *b[] = {"B0010", "B11011011", "B10001", "X3D12", "X27", "B",
|
||||
"X11", "B100111"};
|
||||
int atttypmod[] = {7, 9, 6, 18, 11, 6, -1, -1};
|
||||
|
||||
|
||||
void print_details (unsigned char *s)
|
||||
void
|
||||
print_details(unsigned char *s)
|
||||
{
|
||||
int i;
|
||||
printf ("Length in bytes : %d\n",VARSIZE(s));
|
||||
printf ("Length of bitstring: %d\n",VARBITLEN(s));
|
||||
for (i=8; i<VARSIZE(s); i++)
|
||||
printf ("%X%X ",s[i]>>4,s[i]&0xF);
|
||||
printf("\n");
|
||||
int i;
|
||||
|
||||
printf("Length in bytes : %d\n", VARSIZE(s));
|
||||
printf("Length of bitstring: %d\n", VARBITLEN(s));
|
||||
for (i = 8; i < VARSIZE(s); i++)
|
||||
printf("%X%X ", s[i] >> 4, s[i] & 0xF);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
int
|
||||
main ()
|
||||
main()
|
||||
{
|
||||
int i, j;
|
||||
char *s[numb];
|
||||
int i,
|
||||
j;
|
||||
char *s[numb];
|
||||
|
||||
for (i=0; i<numb; i++) {
|
||||
printf ("Input: %s\n",b[i]);
|
||||
s[i] = zpbitin(b[i], 0, atttypmod[i]);
|
||||
//print_details(s[i]);
|
||||
printf ("%s = %s\n",zpbitout(s[i]),zpbitsout(s[i]));
|
||||
}
|
||||
for (i = 0; i < numb; i++)
|
||||
{
|
||||
printf("Input: %s\n", b[i]);
|
||||
s[i] = zpbitin(b[i], 0, atttypmod[i]);
|
||||
//print_details(s[i]);
|
||||
printf("%s = %s\n", zpbitout(s[i]), zpbitsout(s[i]));
|
||||
}
|
||||
|
||||
printf ("\nCOMPARISONS:\n");
|
||||
for (i=0; i<numb; i++)
|
||||
for (j=i+1; j<numb; j++)
|
||||
printf("%s <=> %s = %d\n",zpbitsout(s[i]),zpbitsout(s[j]),
|
||||
bitcmp(s[i],s[j]));
|
||||
printf("\nCOMPARISONS:\n");
|
||||
for (i = 0; i < numb; i++)
|
||||
for (j = i + 1; j < numb; j++)
|
||||
printf("%s <=> %s = %d\n", zpbitsout(s[i]), zpbitsout(s[j]),
|
||||
bitcmp(s[i], s[j]));
|
||||
|
||||
printf ("\nCONCATENATION:\n");
|
||||
for (i=0; i<numb; i++)
|
||||
for (j=i+1; j<numb; j++)
|
||||
printf("%s || %s = %s\n",zpbitsout(s[i]),zpbitsout(s[j]),
|
||||
zpbitsout(bitcat(s[i],s[j])));
|
||||
printf("\nCONCATENATION:\n");
|
||||
for (i = 0; i < numb; i++)
|
||||
for (j = i + 1; j < numb; j++)
|
||||
printf("%s || %s = %s\n", zpbitsout(s[i]), zpbitsout(s[j]),
|
||||
zpbitsout(bitcat(s[i], s[j])));
|
||||
|
||||
printf("\nSUBSTR:\n");
|
||||
printf("%s (%d,%d) => %s\n",zpbitsout(s[3]),1,8,
|
||||
zpbitsout(bitsubstr(s[3],1,8)));
|
||||
printf("%s (%d,%d) => %s\n",zpbitsout(s[3]),9,8,
|
||||
zpbitsout(bitsubstr(s[3],9,8)));
|
||||
printf("%s (%d,%d) => %s\n",zpbitsout(s[3]),1,9,
|
||||
zpbitsout(bitsubstr(s[3],1,9)));
|
||||
printf("%s (%d,%d) => %s\n",zpbitsout(s[3]),3,5,
|
||||
zpbitsout(bitsubstr(s[3],3,5)));
|
||||
printf("%s (%d,%d) => %s\n",zpbitsout(s[3]),3,9,
|
||||
zpbitsout(bitsubstr(s[3],3,9)));
|
||||
printf("%s (%d,%d) => %s\n",zpbitsout(s[3]),3,17,
|
||||
zpbitsout(bitsubstr(s[3],3,17)));
|
||||
printf ("\nLOGICAL AND:\n");
|
||||
for (i=0; i<numb; i++)
|
||||
for (j=i+1; j<numb; j++)
|
||||
printf("%s & %s = %s\n",zpbitsout(s[i]),zpbitsout(s[j]),
|
||||
zpbitsout(bitand(s[i],s[j])));
|
||||
printf("\nSUBSTR:\n");
|
||||
printf("%s (%d,%d) => %s\n", zpbitsout(s[3]), 1, 8,
|
||||
zpbitsout(bitsubstr(s[3], 1, 8)));
|
||||
printf("%s (%d,%d) => %s\n", zpbitsout(s[3]), 9, 8,
|
||||
zpbitsout(bitsubstr(s[3], 9, 8)));
|
||||
printf("%s (%d,%d) => %s\n", zpbitsout(s[3]), 1, 9,
|
||||
zpbitsout(bitsubstr(s[3], 1, 9)));
|
||||
printf("%s (%d,%d) => %s\n", zpbitsout(s[3]), 3, 5,
|
||||
zpbitsout(bitsubstr(s[3], 3, 5)));
|
||||
printf("%s (%d,%d) => %s\n", zpbitsout(s[3]), 3, 9,
|
||||
zpbitsout(bitsubstr(s[3], 3, 9)));
|
||||
printf("%s (%d,%d) => %s\n", zpbitsout(s[3]), 3, 17,
|
||||
zpbitsout(bitsubstr(s[3], 3, 17)));
|
||||
printf("\nLOGICAL AND:\n");
|
||||
for (i = 0; i < numb; i++)
|
||||
for (j = i + 1; j < numb; j++)
|
||||
printf("%s & %s = %s\n", zpbitsout(s[i]), zpbitsout(s[j]),
|
||||
zpbitsout(bitand(s[i], s[j])));
|
||||
|
||||
printf ("\nLOGICAL OR:\n");
|
||||
for (i=0; i<numb; i++)
|
||||
for (j=i+1; j<numb; j++)
|
||||
printf("%s | %s = %s\n",zpbitsout(s[i]),zpbitsout(s[j]),
|
||||
zpbitsout(bitor(s[i],s[j])));
|
||||
printf("\nLOGICAL OR:\n");
|
||||
for (i = 0; i < numb; i++)
|
||||
for (j = i + 1; j < numb; j++)
|
||||
printf("%s | %s = %s\n", zpbitsout(s[i]), zpbitsout(s[j]),
|
||||
zpbitsout(bitor(s[i], s[j])));
|
||||
|
||||
printf ("\nLOGICAL XOR:\n");
|
||||
for (i=0; i<numb; i++)
|
||||
for (j=i+1; j<numb; j++)
|
||||
printf("%s ^ %s = %s\n",zpbitsout(s[i]),zpbitsout(s[j]),
|
||||
zpbitsout(bitxor(s[i],s[j])));
|
||||
|
||||
printf ("\nLOGICAL NOT:\n");
|
||||
for (i=0; i<numb; i++)
|
||||
printf("~%s = %s\n",zpbitsout(s[i]),zpbitsout(bitnot(s[i])));
|
||||
printf("\nLOGICAL XOR:\n");
|
||||
for (i = 0; i < numb; i++)
|
||||
for (j = i + 1; j < numb; j++)
|
||||
printf("%s ^ %s = %s\n", zpbitsout(s[i]), zpbitsout(s[j]),
|
||||
zpbitsout(bitxor(s[i], s[j])));
|
||||
|
||||
printf("\nLOGICAL NOT:\n");
|
||||
for (i = 0; i < numb; i++)
|
||||
printf("~%s = %s\n", zpbitsout(s[i]), zpbitsout(bitnot(s[i])));
|
||||
|
||||
|
||||
printf ("\nSHIFT LEFT:\n");
|
||||
for (i=0; i<numb; i++) {
|
||||
printf("%s\n",zpbitsout(s[i]));
|
||||
for (j=0; j<=VARBITLEN(s[i]); j++)
|
||||
printf("\t%3d\t%s\n",j,zpbitsout(bitshiftleft(s[i],j)));
|
||||
}
|
||||
printf("\nSHIFT LEFT:\n");
|
||||
for (i = 0; i < numb; i++)
|
||||
{
|
||||
printf("%s\n", zpbitsout(s[i]));
|
||||
for (j = 0; j <= VARBITLEN(s[i]); j++)
|
||||
printf("\t%3d\t%s\n", j, zpbitsout(bitshiftleft(s[i], j)));
|
||||
}
|
||||
|
||||
printf ("\nSHIFT RIGHT:\n");
|
||||
for (i=0; i<numb; i++) {
|
||||
printf("%s\n",zpbitsout(s[i]));
|
||||
for (j=0; j<=VARBITLEN(s[i]); j++)
|
||||
printf("\t%3d\t%s\n",j,zpbitsout(bitshiftright(s[i],j)));
|
||||
}
|
||||
printf("\nSHIFT RIGHT:\n");
|
||||
for (i = 0; i < numb; i++)
|
||||
{
|
||||
printf("%s\n", zpbitsout(s[i]));
|
||||
for (j = 0; j <= VARBITLEN(s[i]); j++)
|
||||
printf("\t%3d\t%s\n", j, zpbitsout(bitshiftright(s[i], j)));
|
||||
}
|
||||
|
||||
printf ("\n\n ********** VARYING **********\n");
|
||||
for (i=0; i<numb; i++) {
|
||||
printf ("Input: %s\n",b[i]);
|
||||
s[i] = varbitin(b[i], 0, atttypmod[i]);
|
||||
/*print_details(s);*/
|
||||
printf ("%s\n",zpbitout(s[i]));
|
||||
printf ("%s\n",zpbitsout(s[i]));
|
||||
}
|
||||
printf("\n\n ********** VARYING **********\n");
|
||||
for (i = 0; i < numb; i++)
|
||||
{
|
||||
printf("Input: %s\n", b[i]);
|
||||
s[i] = varbitin(b[i], 0, atttypmod[i]);
|
||||
/* print_details(s); */
|
||||
printf("%s\n", zpbitout(s[i]));
|
||||
printf("%s\n", zpbitsout(s[i]));
|
||||
}
|
||||
|
||||
printf ("\nCOMPARISONS:\n");
|
||||
for (i=0; i<numb; i++)
|
||||
for (j=i+1; j<numb; j++)
|
||||
printf("%s <=> %s = %d\n",zpbitsout(s[i]),zpbitsout(s[j]),
|
||||
bitcmp(s[i],s[j]));
|
||||
printf("\nCOMPARISONS:\n");
|
||||
for (i = 0; i < numb; i++)
|
||||
for (j = i + 1; j < numb; j++)
|
||||
printf("%s <=> %s = %d\n", zpbitsout(s[i]), zpbitsout(s[j]),
|
||||
bitcmp(s[i], s[j]));
|
||||
|
||||
printf ("\nCONCATENATION:\n");
|
||||
for (i=0; i<numb; i++)
|
||||
for (j=i+1; j<numb; j++)
|
||||
printf("%s || %s = %s\n",zpbitsout(s[i]),zpbitsout(s[j]),
|
||||
zpbitsout(bitcat(s[i],s[j])));
|
||||
printf("\nCONCATENATION:\n");
|
||||
for (i = 0; i < numb; i++)
|
||||
for (j = i + 1; j < numb; j++)
|
||||
printf("%s || %s = %s\n", zpbitsout(s[i]), zpbitsout(s[j]),
|
||||
zpbitsout(bitcat(s[i], s[j])));
|
||||
|
||||
printf("\nSUBSTR:\n");
|
||||
printf("%s (%d,%d) => %s\n",zpbitsout(s[3]),1,8,
|
||||
zpbitsout(bitsubstr(s[3],1,8)));
|
||||
printf("%s (%d,%d) => %s\n",zpbitsout(s[3]),9,8,
|
||||
zpbitsout(bitsubstr(s[3],9,8)));
|
||||
printf("%s (%d,%d) => %s\n",zpbitsout(s[3]),1,9,
|
||||
zpbitsout(bitsubstr(s[3],1,9)));
|
||||
printf("%s (%d,%d) => %s\n",zpbitsout(s[3]),3,5,
|
||||
zpbitsout(bitsubstr(s[3],3,5)));
|
||||
printf("%s (%d,%d) => %s\n",zpbitsout(s[3]),3,9,
|
||||
zpbitsout(bitsubstr(s[3],3,9)));
|
||||
printf("%s (%d,%d) => %s (%s)\n",zpbitsout(s[3]),3,17,
|
||||
zpbitsout(bitsubstr(s[3],3,17)),zpbitsout(bitsubstr(s[3],3,17)));
|
||||
printf ("\nLOGICAL AND:\n");
|
||||
for (i=0; i<numb; i++)
|
||||
for (j=i+1; j<numb; j++)
|
||||
printf("%s & %s = %s\n",zpbitsout(s[i]),zpbitsout(s[j]),
|
||||
zpbitsout(bitand(s[i],s[j])));
|
||||
printf("\nSUBSTR:\n");
|
||||
printf("%s (%d,%d) => %s\n", zpbitsout(s[3]), 1, 8,
|
||||
zpbitsout(bitsubstr(s[3], 1, 8)));
|
||||
printf("%s (%d,%d) => %s\n", zpbitsout(s[3]), 9, 8,
|
||||
zpbitsout(bitsubstr(s[3], 9, 8)));
|
||||
printf("%s (%d,%d) => %s\n", zpbitsout(s[3]), 1, 9,
|
||||
zpbitsout(bitsubstr(s[3], 1, 9)));
|
||||
printf("%s (%d,%d) => %s\n", zpbitsout(s[3]), 3, 5,
|
||||
zpbitsout(bitsubstr(s[3], 3, 5)));
|
||||
printf("%s (%d,%d) => %s\n", zpbitsout(s[3]), 3, 9,
|
||||
zpbitsout(bitsubstr(s[3], 3, 9)));
|
||||
printf("%s (%d,%d) => %s (%s)\n", zpbitsout(s[3]), 3, 17,
|
||||
zpbitsout(bitsubstr(s[3], 3, 17)), zpbitsout(bitsubstr(s[3], 3, 17)));
|
||||
printf("\nLOGICAL AND:\n");
|
||||
for (i = 0; i < numb; i++)
|
||||
for (j = i + 1; j < numb; j++)
|
||||
printf("%s & %s = %s\n", zpbitsout(s[i]), zpbitsout(s[j]),
|
||||
zpbitsout(bitand(s[i], s[j])));
|
||||
|
||||
printf ("\nLOGICAL OR:\n");
|
||||
for (i=0; i<numb; i++)
|
||||
for (j=i+1; j<numb; j++)
|
||||
printf("%s | %s = %s\n",zpbitsout(s[i]),zpbitsout(s[j]),
|
||||
zpbitsout(bitor(s[i],s[j])));
|
||||
printf("\nLOGICAL OR:\n");
|
||||
for (i = 0; i < numb; i++)
|
||||
for (j = i + 1; j < numb; j++)
|
||||
printf("%s | %s = %s\n", zpbitsout(s[i]), zpbitsout(s[j]),
|
||||
zpbitsout(bitor(s[i], s[j])));
|
||||
|
||||
printf ("\nLOGICAL XOR:\n");
|
||||
for (i=0; i<numb; i++)
|
||||
for (j=i+1; j<numb; j++)
|
||||
printf("%s ^ %s = %s\n",zpbitsout(s[i]),zpbitsout(s[j]),
|
||||
zpbitsout(bitxor(s[i],s[j])));
|
||||
|
||||
printf ("\nLOGICAL NOT:\n");
|
||||
for (i=0; i<numb; i++)
|
||||
printf("~%s = %s\n",zpbitsout(s[i]),zpbitsout(bitnot(s[i])));
|
||||
printf("\nLOGICAL XOR:\n");
|
||||
for (i = 0; i < numb; i++)
|
||||
for (j = i + 1; j < numb; j++)
|
||||
printf("%s ^ %s = %s\n", zpbitsout(s[i]), zpbitsout(s[j]),
|
||||
zpbitsout(bitxor(s[i], s[j])));
|
||||
|
||||
printf("\nLOGICAL NOT:\n");
|
||||
for (i = 0; i < numb; i++)
|
||||
printf("~%s = %s\n", zpbitsout(s[i]), zpbitsout(bitnot(s[i])));
|
||||
|
||||
|
||||
printf ("\nSHIFT LEFT:\n");
|
||||
for (i=0; i<numb; i++) {
|
||||
printf("%s\n",zpbitsout(s[i]));
|
||||
for (j=0; j<=VARBITLEN(s[i]); j++)
|
||||
printf("\t%3d\t%s\n",j,zpbitsout(bitshiftleft(s[i],j)));
|
||||
}
|
||||
printf("\nSHIFT LEFT:\n");
|
||||
for (i = 0; i < numb; i++)
|
||||
{
|
||||
printf("%s\n", zpbitsout(s[i]));
|
||||
for (j = 0; j <= VARBITLEN(s[i]); j++)
|
||||
printf("\t%3d\t%s\n", j, zpbitsout(bitshiftleft(s[i], j)));
|
||||
}
|
||||
|
||||
printf ("\nSHIFT RIGHT:\n");
|
||||
for (i=0; i<numb; i++) {
|
||||
printf("%s\n",zpbitsout(s[i]));
|
||||
for (j=0; j<=VARBITLEN(s[i]); j++)
|
||||
printf("\t%3d\t%s\n",j,zpbitsout(bitshiftright(s[i],j)));
|
||||
}
|
||||
printf("\nSHIFT RIGHT:\n");
|
||||
for (i = 0; i < numb; i++)
|
||||
{
|
||||
printf("%s\n", zpbitsout(s[i]));
|
||||
for (j = 0; j <= VARBITLEN(s[i]); j++)
|
||||
printf("\t%3d\t%s\n", j, zpbitsout(bitshiftright(s[i], j)));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -36,7 +36,7 @@
|
||||
* Decode time string 00:00:00 through 24:00:00.
|
||||
*/
|
||||
static int
|
||||
decode_24h_time(char *str, struct tm *tm, double *fsec)
|
||||
decode_24h_time(char *str, struct tm * tm, double *fsec)
|
||||
{
|
||||
char *cp;
|
||||
|
||||
@ -51,9 +51,7 @@ decode_24h_time(char *str, struct tm *tm, double *fsec)
|
||||
*fsec = 0;
|
||||
}
|
||||
else if (*cp != ':')
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
str = cp + 1;
|
||||
@ -72,10 +70,10 @@ decode_24h_time(char *str, struct tm *tm, double *fsec)
|
||||
}
|
||||
|
||||
/* do a sanity check */
|
||||
if ( (tm->tm_hour < 0) || (tm->tm_hour > 24)
|
||||
|| (tm->tm_min < 0) || (tm->tm_min > 59)
|
||||
|| (tm->tm_sec < 0) || (tm->tm_sec > 59)
|
||||
|| (*fsec < 0) )
|
||||
if ((tm->tm_hour < 0) || (tm->tm_hour > 24)
|
||||
|| (tm->tm_min < 0) || (tm->tm_min > 59)
|
||||
|| (tm->tm_sec < 0) || (tm->tm_sec > 59)
|
||||
|| (*fsec < 0))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
@ -265,7 +263,7 @@ currentdate()
|
||||
int4
|
||||
date2mjd(DateADT val)
|
||||
{
|
||||
int result;
|
||||
int result;
|
||||
|
||||
result = val + JDATE_2000 - 2400000.5;
|
||||
|
||||
@ -276,8 +274,8 @@ date2mjd(DateADT val)
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* tab-width: 4
|
||||
* c-indent-level: 4
|
||||
* c-basic-offset: 4
|
||||
* tab-width: 4
|
||||
* c-indent-level: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
|
@ -20,8 +20,8 @@ DateADT currentdate(void);
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* tab-width: 4
|
||||
* c-indent-level: 4
|
||||
* c-basic-offset: 4
|
||||
* tab-width: 4
|
||||
* c-indent-level: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
|
@ -38,6 +38,7 @@ extern int assertTest(int val);
|
||||
|
||||
#ifdef ASSERT_CHECKING_TEST
|
||||
extern int assertEnable(int val);
|
||||
|
||||
#endif
|
||||
|
||||
int
|
||||
@ -84,7 +85,8 @@ active_listeners(text *relname)
|
||||
ScanKeyData key;
|
||||
Datum d;
|
||||
bool isnull;
|
||||
int len, pid;
|
||||
int len,
|
||||
pid;
|
||||
int count = 0;
|
||||
int ourpid = getpid();
|
||||
char listen_name[NAMEDATALEN];
|
||||
@ -92,8 +94,9 @@ active_listeners(text *relname)
|
||||
lRel = heap_openr(ListenerRelationName, AccessShareLock);
|
||||
tdesc = RelationGetDescr(lRel);
|
||||
|
||||
if (relname && (VARSIZE(relname) > VARHDRSZ)) {
|
||||
len = MIN(VARSIZE(relname)-VARHDRSZ, NAMEDATALEN-1);
|
||||
if (relname && (VARSIZE(relname) > VARHDRSZ))
|
||||
{
|
||||
len = MIN(VARSIZE(relname) - VARHDRSZ, NAMEDATALEN - 1);
|
||||
strncpy(listen_name, VARDATA(relname), len);
|
||||
listen_name[len] = '\0';
|
||||
ScanKeyEntryInitialize(&key, 0,
|
||||
@ -101,15 +104,16 @@ active_listeners(text *relname)
|
||||
F_NAMEEQ,
|
||||
PointerGetDatum(listen_name));
|
||||
sRel = heap_beginscan(lRel, 0, SnapshotNow, 1, &key);
|
||||
} else {
|
||||
sRel = heap_beginscan(lRel, 0, SnapshotNow, 0, (ScanKey)NULL);
|
||||
}
|
||||
else
|
||||
sRel = heap_beginscan(lRel, 0, SnapshotNow, 0, (ScanKey) NULL);
|
||||
|
||||
while (HeapTupleIsValid(lTuple = heap_getnext(sRel, 0)))
|
||||
{
|
||||
d = heap_getattr(lTuple, Anum_pg_listener_pid, tdesc, &isnull);
|
||||
pid = DatumGetInt32(d);
|
||||
if ((pid == ourpid) || (kill(pid, SIGTSTP) == 0)) {
|
||||
if ((pid == ourpid) || (kill(pid, SIGTSTP) == 0))
|
||||
{
|
||||
/* elog(NOTICE, "%d ok", pid); */
|
||||
count++;
|
||||
}
|
||||
@ -134,6 +138,7 @@ assert_test(int val)
|
||||
{
|
||||
return assertTest(val);
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -141,8 +146,8 @@ assert_test(int val)
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* tab-width: 4
|
||||
* c-indent-level: 4
|
||||
* c-basic-offset: 4
|
||||
* tab-width: 4
|
||||
* c-indent-level: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
|
@ -10,8 +10,10 @@ int active_listeners(text *relname);
|
||||
|
||||
#ifdef USE_ASSERT_CHECKING
|
||||
int assert_enable(int val);
|
||||
|
||||
#ifdef ASSERT_CHECKING_TEST
|
||||
int assert_test(int val);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -19,8 +21,8 @@ int assert_test(int val);
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* tab-width: 4
|
||||
* c-indent-level: 4
|
||||
* c-basic-offset: 4
|
||||
* tab-width: 4
|
||||
* c-indent-level: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
/*
|
||||
* DEF_PGPORT is the TCP port number on which the Postmaster listens by
|
||||
* default. This can be overriden by command options, environment variables,
|
||||
* default. This can be overriden by command options, environment variables,
|
||||
* and the postconfig hook. (set by build script)
|
||||
*/
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -23,7 +23,7 @@
|
||||
#define ISO8859
|
||||
|
||||
#define MIN(x, y) ((x) < (y) ? (x) : (y))
|
||||
#define VALUE(char) ((char) - '0')
|
||||
#define VALUE(char) ((char) - '0')
|
||||
#define DIGIT(val) ((val) + '0')
|
||||
#define ISOCTAL(c) (((c) >= '0') && ((c) <= '7'))
|
||||
#ifndef ISO8859
|
||||
@ -89,9 +89,8 @@ string_output(unsigned char *data, int size)
|
||||
break;
|
||||
case '{':
|
||||
/* Escape beginning of string, to distinguish from arrays */
|
||||
if (p == data) {
|
||||
if (p == data)
|
||||
len++;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (NOTPRINTABLE(*p))
|
||||
@ -137,9 +136,8 @@ string_output(unsigned char *data, int size)
|
||||
break;
|
||||
case '{':
|
||||
/* Escape beginning of string, to distinguish from arrays */
|
||||
if (p == data) {
|
||||
if (p == data)
|
||||
*r++ = '\\';
|
||||
}
|
||||
*r++ = c;
|
||||
break;
|
||||
default:
|
||||
@ -361,14 +359,15 @@ c_charin(unsigned char *str)
|
||||
{
|
||||
return (string_input(str, 1, 0, NULL));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* end of file */
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* tab-width: 4
|
||||
* c-indent-level: 4
|
||||
* c-basic-offset: 4
|
||||
* tab-width: 4
|
||||
* c-indent-level: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
|
@ -1,24 +1,25 @@
|
||||
#ifndef STRING_IO_H
|
||||
#define STRING_IO_H
|
||||
|
||||
unsigned char* string_output(unsigned char *data, int size);
|
||||
unsigned char* string_input(unsigned char *str, int size, int hdrsize,
|
||||
int *rtn_size);
|
||||
unsigned char* c_charout(int32 c);
|
||||
unsigned char* c_textout(struct varlena * vlena);
|
||||
unsigned char* c_varcharout(unsigned char *s);
|
||||
unsigned char *string_output(unsigned char *data, int size);
|
||||
unsigned char *string_input(unsigned char *str, int size, int hdrsize,
|
||||
int *rtn_size);
|
||||
unsigned char *c_charout(int32 c);
|
||||
unsigned char *c_textout(struct varlena * vlena);
|
||||
unsigned char *c_varcharout(unsigned char *s);
|
||||
|
||||
#if 0
|
||||
struct varlena* c_textin(unsigned char *str);
|
||||
int32* c_charin(unsigned char *str)
|
||||
struct varlena *c_textin(unsigned char *str);
|
||||
int32 *
|
||||
c_charin(unsigned char *str)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* tab-width: 4
|
||||
* c-indent-level: 4
|
||||
* c-basic-offset: 4
|
||||
* tab-width: 4
|
||||
* c-indent-level: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
|
@ -96,8 +96,8 @@ user_unlock_all()
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* tab-width: 4
|
||||
* c-indent-level: 4
|
||||
* c-basic-offset: 4
|
||||
* tab-width: 4
|
||||
* c-indent-level: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
|
@ -13,8 +13,8 @@ int user_unlock_all(void);
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* tab-width: 4
|
||||
* c-indent-level: 4
|
||||
* c-basic-offset: 4
|
||||
* tab-width: 4
|
||||
* c-indent-level: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
|
Reference in New Issue
Block a user