]> mj.ucw.cz Git - libucw.git/commitdiff
Moved customizations for Centrum to centrum/custom.
authorMartin Mares <mj@ucw.cz>
Sun, 18 Aug 2002 09:48:38 +0000 (09:48 +0000)
committerMartin Mares <mj@ucw.cz>
Sun, 18 Aug 2002 09:48:38 +0000 (09:48 +0000)
lib/custom.h now contains only generic definitions which will appear
in the freely distributable version.

lib/custom.c [deleted file]
lib/custom.h

diff --git a/lib/custom.c b/lib/custom.c
deleted file mode 100644 (file)
index 3e9d19d..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- *     Sherlock: Custom Parts of Configuration
- *
- *     (c) 2001--2002 Martin Mares <mj@ucw.cz>
- */
-
-#include "lib/lib.h"
-#include "lib/index.h"
-
-#include <stdlib.h>
-
-#ifdef CONFIG_IMAGES
-
-void
-custom_create_attrs(struct odes *odes, struct card_attr *ca)
-{
-  byte *x;
-  uns ox, oy, tw, th, ncolors;
-  uns ifmt, isize, icol;
-  byte ocspace[10];
-  byte *ctype;
-
-  x = obj_find_aval(odes, 'G');
-  ctype = obj_find_aval(odes, 'T');
-  if (!x || !ctype || sscanf(x, "%d%d%s%d%d%d", &ox, &oy, ocspace, &ncolors, &tw, &th) != 6)
-    {
-      ca->image_flags = 0;
-      return;
-    }
-
-  if (!strcasecmp(ctype, "image/jpeg"))
-    ifmt = 1;
-  else if (!strcasecmp(ctype, "image/png"))
-    ifmt = 2;
-  else if (!strcasecmp(ctype, "image/gif"))
-    ifmt = 3;
-  else
-    {
-      log(L_ERROR, "Unknown image content-type: %s", ctype);
-      ifmt = 0;
-    }
-
-  if (ox <= 100 && oy <= 100)
-    isize = 0;
-  else if (ox <= 320 && oy <= 200)
-    isize = 1;
-  else if (ox <= 640 && oy <= 480)
-    isize = 2;
-  else
-    isize = 3;
-
-  if (!strcasecmp(ocspace, "GRAY"))
-    icol = 0;
-  else if (ncolors <= 16)
-    icol = 1;
-  else if (ncolors <= 256)
-    icol = 2;
-  else
-    icol = 3;
-
-  ca->image_flags = ifmt | (isize << 2) | (icol << 4);
-}
-
-byte *
-custom_it_parse(u32 *dest, byte *value, uns intval)
-{
-  if (value)
-    return "IMGTYPE: number expected";
-  if (intval > 3)
-    return "IMGTYPE out of range";
-  *dest = intval;
-  return NULL;
-}
-
-byte *
-custom_is_parse(u32 *dest, byte *value, uns intval)
-{
-  if (value)
-    return "IMGSIZE: number expected";
-  if (intval > 3)
-    return "IMGSIZE out of range";
-  *dest = intval;
-  return NULL;
-}
-
-byte *
-custom_ic_parse(u32 *dest, byte *value, uns intval)
-{
-  if (value)
-    return "IMGCOLORS: number expected";
-  if (intval > 3)
-    return "IMGCOLORS out of range";
-  *dest = intval;
-  return NULL;
-}
-
-#endif
index 4d0dd5c9096fab3570c95032fdbafa32a5ae58f5..1056655762ca4f266db3f99961db22a7f49d30e5 100644 (file)
@@ -17,19 +17,13 @@ enum word_type {
   WT_KEYWORD,                          /* Explicitly marked keyword */
   WT_META,                             /* Various meta-information */
   WT_ALT,                              /* Alternate texts for graphical elements */
-  WT_URL1,                             /* Word extracted from document URL (low and high weight) */
-  WT_URL2,
-  WT_FILE,                             /* Part of file name */
-  WT_LINK,                             /* Link text */
-  WT_CAT_TITLE,                                /* Catalog title */
-  WT_CAT_DESC,                         /* Catalog description */
   WT_MAX
 };
 
 /* Descriptive names used for user output */
 #define WORD_TYPE_USER_NAMES                                                   \
    "reserved", "text", "emph", "small", "title", "hdr1", "hdr2", "keywd",      \
-   "meta", "alt", "urlword1", "urlword2", "nameword", "link", "ctitle", "cdesc"
+   "meta", "alt"
 
 /* Keywords for word type names */
 #define WORD_TYPE_NAMES                                \
@@ -43,22 +37,17 @@ enum word_type {
        T(HDR2, 1 << WT_BIG_HEADING)            \
        T(KEYWD, 1 << WT_KEYWORD)               \
        T(META, 1 << WT_META)                   \
-       T(ALT, 1 << WT_ALT)                     \
-       T(URLWORD, (1 << WT_URL1) | (1 << WT_URL2))     \
-       T(FILE, 1 << WT_FILE)                   \
-       T(LINK, 1 << WT_LINK)                   \
-       T(CTITLE, 1 << WT_CAT_TITLE)            \
-       T(CDESC, 1 << WT_CAT_DESC)
+       T(ALT, 1 << WT_ALT)
 
 /* These types are not shown in document contexts */
-#define WORD_TYPES_HIDDEN ((1 << WT_URL1) | (1 << WT_URL2) | (1 << WT_FILE))
+#define WORD_TYPES_HIDDEN 0
 
 /* These types are separated out when printing contexts */
 #define WORD_TYPES_META ((1 << WT_TITLE) | (1 << WT_KEYWORD) | \
-       (1 << WT_META) | (1 << WT_CAT_TITLE) | (1 << WT_CAT_DESC))
+       (1 << WT_META))
 
 /* These types are always matched without accents if accent mode is set to "auto" */
-#define WORD_TYPES_NO_AUTO_ACCENT ((1 << WT_URL1) | (1 << WT_URL2) | (1 << WT_FILE))
+#define WORD_TYPES_NO_AUTO_ACCENT 0
 
 /* String types */
 
@@ -114,45 +103,8 @@ enum string_type {
  *  A good place for definitions of the functions is lib/custom.c.
  */
 
-struct card_attr;
-struct odes;
-
-#ifdef CONFIG_IMAGES
-
-/*
- *  We store several image properties to card_attr->image_flags and
- *  match them as custom attributes. The image_flags byte contains:
- *
- *  bits 0--1  image format (0: not an image, 1: JPEG, 2: PNG, 3: GIF)
- *  bits 2--3   image size (0: <=100x100, 1: <=320x200, 2: <=640x480, 3: other)
- *  bits 4--5   image colors (0: grayscale, 1: <=16, 2: <=256, 3: >256)
- */
-
-#define CUSTOM_CARD_ATTRS \
-       byte image_flags;
-
-#define CUSTOM_ATTRS \
-       SMALL_SET_ATTR(ifmt, IMGTYPE, custom_it_get, custom_it_parse)           \
-       SMALL_SET_ATTR(isize, IMGSIZE, custom_is_get, custom_is_parse)          \
-       SMALL_SET_ATTR(icolors, IMGCOLORS, custom_ic_get, custom_ic_parse)
-
-void custom_create_attrs(struct odes *odes, struct card_attr *ca);
-
-/* These must be macros instead of inline functions, struct card_attr is not fully defined yet */
-#define custom_it_get(ca) ((ca)->image_flags & 3)
-#define custom_is_get(ca) (((ca)->image_flags >> 2) & 3)
-#define custom_ic_get(ca) (((ca)->image_flags >> 4) & 3)
-
-byte *custom_it_parse(u32 *dest, byte *value, uns intval);
-byte *custom_is_parse(u32 *dest, byte *value, uns intval);
-byte *custom_ic_parse(u32 *dest, byte *value, uns intval);
-
-#else
-
-/* No custom attributes defined */
+/* No custom attributes defined yet */
 
 #define CUSTOM_CARD_ATTRS
 #define CUSTOM_ATTRS
 static inline void custom_create_attrs(struct odes *odes UNUSED, struct card_attr *ca UNUSED) { }
-
-#endif