2 * ========================================================================
3 * Copyright 2013-2022 Eduardo Chappa
4 * Copyright 2006 University of Washington
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * ========================================================================
15 /*======================================================================
18 Implements known escape code matching
23 #include "../pith/headers.h"
24 #include "../pith/escapes.h"
28 /*------------------------------------------------------------------
29 This list of known escape sequences is taken from RFC's 1486 and 1554
30 and draft-apng-cc-encoding, and the X11R5 source with only a remote
31 understanding of what this all means...
33 NOTE: if the length of these should extend beyond 4 chars, fix
34 MAX_ESC_LEN in filter.c
37 static char *known_escapes
[] = {
38 "(B", "(J", "$@", "$B", /* RFC 1468 */
42 static char *known_escapes
[] = {
43 "(B", "(J", "$@", "$B", /* RFC 1468 */
45 "$A", "$(C", "$(D", ".A", ".F", /* added by RFC 1554 */
46 "$)C", "$)A", "$*E", "$*X", /* those in apng-draft */
47 "$+G", "$+H", "$+I", "$+J", "$+K",
49 ")I", "-A", "-B", "-C", "-D", /* codes form X11R5 source */
50 "-F", "-G", "-H", "-L", "-M",
51 "-$(A", "$(B", "$)B", "$)D",
57 match_escapes(char *esc_seq
)
62 for(p
= known_escapes
; *p
&& strncmp(esc_seq
, *p
, n
= strlen(*p
)); p
++)
65 return(*p
? n
+ 1 : 0);