11\echo Use " CREATE EXTENSION pgpm-base32" to load this file. \quit
22CREATE SCHEMA base32 ;
33
4- CREATE FUNCTION base32 .binary_to_int(input text ) RETURNS int AS $EOFCODE$
4+ CREATE FUNCTION base32 .binary_to_int(
5+ input text
6+ ) RETURNS int AS $EOFCODE$
57DECLARE
68 i int ;
79 buf text ;
1214END;
1315$EOFCODE$ LANGUAGE plpgsql IMMUTABLE;
1416
15- CREATE FUNCTION base32 .to_ascii(input text ) RETURNS int [] AS $EOFCODE$
17+ CREATE FUNCTION base32 .to_ascii(
18+ input text
19+ ) RETURNS int [] AS $EOFCODE$
1620DECLARE
1721 i int ;
1822 output int [];
2428END;
2529$EOFCODE$ LANGUAGE plpgsql IMMUTABLE;
2630
27- CREATE FUNCTION base32 .to_binary(input int ) RETURNS text AS $EOFCODE$
31+ CREATE FUNCTION base32 .to_binary(
32+ input int
33+ ) RETURNS text AS $EOFCODE$
2834DECLARE
2935 i int = 1 ;
3036 j int = 0 ;
3945END;
4046$EOFCODE$ LANGUAGE plpgsql IMMUTABLE;
4147
42- CREATE FUNCTION base32 .to_binary(input int []) RETURNS text [] AS $EOFCODE$
48+ CREATE FUNCTION base32 .to_binary(
49+ input int []
50+ ) RETURNS text [] AS $EOFCODE$
4351DECLARE
4452 i int ;
4553 output text [];
5159END;
5260$EOFCODE$ LANGUAGE plpgsql IMMUTABLE;
5361
54- CREATE FUNCTION base32 .to_groups(input text []) RETURNS text [] AS $EOFCODE$
62+ CREATE FUNCTION base32 .to_groups(
63+ input text []
64+ ) RETURNS text [] AS $EOFCODE$
5565DECLARE
5666 i int ;
5767 output text [];
@@ -67,12 +77,17 @@ BEGIN
6777END;
6878$EOFCODE$ LANGUAGE plpgsql IMMUTABLE;
6979
70- CREATE FUNCTION base32 .string_nchars(text , int ) RETURNS text [] AS $EOFCODE$
80+ CREATE FUNCTION base32 .string_nchars(
81+ text ,
82+ int
83+ ) RETURNS text [] AS $EOFCODE$
7184SELECT ARRAY(SELECT substring ($1 from n for $2 )
7285 FROM generate_series(1 , length($1 ), $2 ) n);
7386$EOFCODE$ LANGUAGE sql IMMUTABLE;
7487
75- CREATE FUNCTION base32 .to_chunks(input text []) RETURNS text [] AS $EOFCODE$
88+ CREATE FUNCTION base32 .to_chunks(
89+ input text []
90+ ) RETURNS text [] AS $EOFCODE$
7691DECLARE
7792 i int ;
7893 output text [];
8398END;
8499$EOFCODE$ LANGUAGE plpgsql IMMUTABLE;
85100
86- CREATE FUNCTION base32 .fill_chunks(input text []) RETURNS text [] AS $EOFCODE$
101+ CREATE FUNCTION base32 .fill_chunks(
102+ input text []
103+ ) RETURNS text [] AS $EOFCODE$
87104DECLARE
88105 i int ;
89106 output text [];
@@ -101,7 +118,9 @@ BEGIN
101118END;
102119$EOFCODE$ LANGUAGE plpgsql IMMUTABLE;
103120
104- CREATE FUNCTION base32 .to_decimal(input text []) RETURNS text [] AS $EOFCODE$
121+ CREATE FUNCTION base32 .to_decimal(
122+ input text []
123+ ) RETURNS text [] AS $EOFCODE$
105124DECLARE
106125 i int ;
107126 output text [];
@@ -122,7 +141,9 @@ BEGIN
122141END;
123142$EOFCODE$ LANGUAGE plpgsql IMMUTABLE;
124143
125- CREATE FUNCTION base32 .base32_alphabet(input int ) RETURNS char (1 ) AS $EOFCODE$
144+ CREATE FUNCTION base32 .base32_alphabet(
145+ input int
146+ ) RETURNS char (1 ) AS $EOFCODE$
126147DECLARE
127148 alphabet text [] = ARRAY[
128149 ' A' , ' B' , ' C' , ' D' , ' E' , ' F' ,
@@ -137,7 +158,9 @@ BEGIN
137158END;
138159$EOFCODE$ LANGUAGE plpgsql IMMUTABLE;
139160
140- CREATE FUNCTION base32 .to_base32(input text []) RETURNS text AS $EOFCODE$
161+ CREATE FUNCTION base32 .to_base32(
162+ input text []
163+ ) RETURNS text AS $EOFCODE$
141164DECLARE
142165 i int ;
143166 output text [];
@@ -158,7 +181,9 @@ BEGIN
158181END;
159182$EOFCODE$ LANGUAGE plpgsql IMMUTABLE;
160183
161- CREATE FUNCTION base32 .encode(input text ) RETURNS text AS $EOFCODE$
184+ CREATE FUNCTION base32 .encode(
185+ input text
186+ ) RETURNS text AS $EOFCODE$
162187BEGIN
163188 IF (character_length(input) = 0 ) THEN
164189 RETURN ' ' ;
@@ -183,7 +208,9 @@ BEGIN
183208END;
184209$EOFCODE$ LANGUAGE plpgsql IMMUTABLE;
185210
186- CREATE FUNCTION base32 .base32_alphabet_to_decimal(input text ) RETURNS text AS $EOFCODE$
211+ CREATE FUNCTION base32 .base32_alphabet_to_decimal(
212+ input text
213+ ) RETURNS text AS $EOFCODE$
187214DECLARE
188215 alphabet text = ' ABCDEFGHIJKLMNOPQRSTUVWXYZ234567' ;
189216 alpha int ;
@@ -196,7 +223,9 @@ BEGIN
196223END;
197224$EOFCODE$ LANGUAGE plpgsql IMMUTABLE;
198225
199- CREATE FUNCTION base32 .base32_to_decimal(input text ) RETURNS text [] AS $EOFCODE$
226+ CREATE FUNCTION base32 .base32_to_decimal(
227+ input text
228+ ) RETURNS text [] AS $EOFCODE$
200229DECLARE
201230 i int ;
202231 output text [];
@@ -209,7 +238,9 @@ BEGIN
209238END;
210239$EOFCODE$ LANGUAGE plpgsql STABLE;
211240
212- CREATE FUNCTION base32 .decimal_to_chunks(input text []) RETURNS text [] AS $EOFCODE$
241+ CREATE FUNCTION base32 .decimal_to_chunks(
242+ input text []
243+ ) RETURNS text [] AS $EOFCODE$
213244DECLARE
214245 i int ;
215246 part text ;
@@ -227,7 +258,9 @@ BEGIN
227258END;
228259$EOFCODE$ LANGUAGE plpgsql STABLE;
229260
230- CREATE FUNCTION base32 .base32_alphabet_to_decimal_int(input text ) RETURNS int AS $EOFCODE$
261+ CREATE FUNCTION base32 .base32_alphabet_to_decimal_int(
262+ input text
263+ ) RETURNS int AS $EOFCODE$
231264DECLARE
232265 alphabet text = ' ABCDEFGHIJKLMNOPQRSTUVWXYZ234567' ;
233266 alpha int ;
@@ -237,7 +270,10 @@ BEGIN
237270END;
238271$EOFCODE$ LANGUAGE plpgsql IMMUTABLE;
239272
240- CREATE FUNCTION base32 .zero_fill(a int , b int ) RETURNS bigint AS $EOFCODE$
273+ CREATE FUNCTION base32 .zero_fill(
274+ a int ,
275+ b int
276+ ) RETURNS bigint AS $EOFCODE$
241277DECLARE
242278 bin text ;
243279 m int ;
@@ -269,7 +305,9 @@ BEGIN
269305END;
270306$EOFCODE$ LANGUAGE plpgsql IMMUTABLE;
271307
272- CREATE FUNCTION base32 .valid(input text ) RETURNS boolean AS $EOFCODE$
308+ CREATE FUNCTION base32 .valid(
309+ input text
310+ ) RETURNS boolean AS $EOFCODE$
273311BEGIN
274312 IF (upper (input) ~* ' ^[A-Z2-7]+=*$' ) THEN
275313 RETURN true;
@@ -278,7 +316,9 @@ BEGIN
278316END;
279317$EOFCODE$ LANGUAGE plpgsql IMMUTABLE;
280318
281- CREATE FUNCTION base32 .decode(input text ) RETURNS text AS $EOFCODE$
319+ CREATE FUNCTION base32 .decode(
320+ input text
321+ ) RETURNS text AS $EOFCODE$
282322DECLARE
283323 i int ;
284324 arr int [];
0 commit comments