PostgreSQL Source Code: src/common/encnames.c Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13#include "c.h"

14

15#include <ctype.h>

17

19

20

21

22

23

24

25

26

27

28

29

30

31

32

34{

38

40{

41 {

43 },

44 {

46 },

47 {

49 },

50 {

52 },

53

54 {

56 },

57

58 {

60 },

61

62 {

64 },

65

66 {

68 },

69

70

71 {

73 },

74 {

76 },

77

78 {

80 },

81 {

83 },

84 {

86 },

87 {

89 },

90 {

92 },

93 {

95 },

96 {

98 },

99 {

101 },

102 {

104 },

105 {

107 },

108 {

110 },

111 {

113 },

114 {

116 },

117 {

119 },

120 {

122 },

123

124 {

126 },

127

128 {

130 },

131 {

133 },

134 {

136 },

137 {

139 },

140 {

142 },

143 {

145 },

146 {

148 },

149 {

151 },

152 {

154 },

155 {

157 },

158 {

160 },

161 {

163 },

164 {

166 },

167 {

169 },

170 {

172 },

173

174 {

176 },

177

178 {

180 },

181 {

183 },

184 {

186 },

187 {

189 },

190 {

192 },

193 {

195 },

196 {

198 },

199 {

201 },

202 {

204 },

205

206 {

208 },

209 {

211 },

212 {

214 },

215 {

217 },

218 {

220 },

221 {

223 },

224 {

226 },

227 {

229 },

230 {

232 },

233 {

235 },

236 {

238 },

239 {

241 },

242 {

244 },

245 {

247 },

248 {

250 },

251 {

253 },

254 {

256 },

257 {

259 },

260 {

262 },

263 {

265 },

266 {

268 },

269 {

271 },

272 {

274 },

275 {

277 },

278 {

280 },

281 {

283 },

284 {

286 },

287 {

289 },

290 {

292 },

293 {

295 }

296};

297

298

299

300

301

302#ifndef WIN32

303#define DEF_ENC2NAME(name, codepage) { #name, PG_##name }

304#else

305#define DEF_ENC2NAME(name, codepage) { #name, PG_##name, codepage }

306#endif

307

309{

352};

353

354

355

356

357

358

359

361{

404};

405

406

407

408

409

410

411

412

413

415{

451};

452

454 "pg_enc2icu_tbl incomplete");

455

456

457

458

459

460bool

462{

464 return false;

466}

467

468

469

470

471const char *

473{

475 return NULL;

477}

478

479

480

481

482

483

484int

486{

488

490 return -1;

491

493 return -1;

494

495 return enc;

496}

497

498int

500{

502

504 return -1;

505

507 return -1;

508

509 return enc;

510}

511

512int

514{

516}

517

518

519

520

521

522

523static char *

525{

526 const char *p;

527 char *np;

528

529 for (p = key, np = newkey; *p != '\0'; p++)

530 {

531 if (isalnum((unsigned char) *p))

532 {

533 if (*p >= 'A' && *p <= 'Z')

534 *np++ = *p + 'a' - 'A';

535 else

536 *np++ = *p;

537 }

538 }

539 *np = '\0';

540 return newkey;

541}

542

543

544

545

546

547

548int

550{

553 *last = base + nel - 1,

554 *position;

555 int result;

558

559 if (name == NULL || *name == '\0')

560 return -1;

561

563 return -1;

564

566

567 while (last >= base)

568 {

569 position = base + ((last - base) >> 1);

570 result = key[0] - position->name[0];

571

572 if (result == 0)

573 {

574 result = strcmp(key, position->name);

575 if (result == 0)

576 return position->encoding;

577 }

578 if (result < 0)

579 last = position - 1;

580 else

581 base = position + 1;

582 }

583 return -1;

584}

585

586const char *

588{

590 {

592

594 return p->name;

595 }

596 return "";

597}

const char * pg_enc2gettext_tbl[]

StaticAssertDecl(lengthof(pg_enc2icu_tbl)==PG_ENCODING_BE_LAST+1, "pg_enc2icu_tbl incomplete")

const char * pg_encoding_to_char(int encoding)

const pg_enc2name pg_enc2name_tbl[]

int pg_char_to_encoding(const char *name)

static char * clean_encoding_name(const char *key, char *newkey)

const char * get_encoding_name_for_icu(int encoding)

static const char *const pg_enc2icu_tbl[]

int pg_valid_server_encoding_id(int encoding)

#define DEF_ENC2NAME(name, codepage)

int pg_valid_server_encoding(const char *name)

static const pg_encname pg_encname_tbl[]

int pg_valid_client_encoding(const char *name)

bool is_encoding_supported_by_icu(int encoding)

struct pg_encname pg_encname

Assert(PointerIsAligned(start, uint64))

#define PG_VALID_ENCODING(_enc)

#define PG_VALID_FE_ENCODING(_enc)

#define PG_VALID_BE_ENCODING(_enc)

#define PG_ENCODING_BE_LAST