示例#1
0
static Lisp_Object
msprinter_device_system_metrics (struct device *d,
				 enum device_metrics m)
{
  switch (m)
    {
      /* Device sizes - pixel and mm */
#define FROB(met, index1, index2)			\
    case DM_##met:					\
      return build_devicecaps_cons			\
         (DEVICE_MSPRINTER_HDC (d), index1, index2);

      FROB (size_device, PHYSICALWIDTH, PHYSICALHEIGHT);
      FROB (size_device_mm, HORZSIZE, VERTSIZE);
      FROB (size_workspace, HORZRES, VERTRES);
      FROB (offset_workspace, PHYSICALOFFSETX, PHYSICALOFFSETY);
      FROB (device_dpi, LOGPIXELSX, LOGPIXELSY);
#undef FROB

    case DM_num_bit_planes:
      /* this is what X means by bitplanes therefore we ought to be
         consistent. num planes is always 1 under mswindows and
         therefore useless */
      return make_fixnum (GetDeviceCaps (DEVICE_MSPRINTER_HDC (d), BITSPIXEL));

    case DM_num_color_cells:	/* Printers are non-palette devices */
    case DM_slow_device:	/* Animation would be a really bad idea */
    case DM_security:		/* Not provided by windows */
      return Qzero;
    }

  /* Do not know such property */
  return Qunbound;
}
/* Send a new blob travelling upward.
   This blob will actually be composed of N metaballs that are near
   each other.
 */
static void
launch_balls (ModeInfo *mi)
{
  lavalite_configuration *bp = &bps[MI_SCREEN(mi)];
  metaball *b0 = get_ball (mi);
  int i;

  if (!b0) return;
  reset_ball (mi, b0);

  for (i = 0; i < bp->blobs_per_group; i++)
    {
      metaball *b1 = get_ball (mi);
      if (!b1) break;
      *b1 = *b0;

      reset_ball (mi, b1);
      b1->leader = b0;

# define FROB(FIELD,AMT) \
         b1->FIELD += (bellrand(AMT) * b0->FIELD)

   /* FROB (pos_r,  0.7); */
   /* FROB (pos_th, 0.7); */
      FROB (dr, 0.8);
      FROB (dz, 0.6);
# undef FROB
    }

}
示例#3
0
void
nsMsgKeySet::test_ranges(void)
{
  char *string;
  nsMsgKeySet *set;
  char *s;
  PRInt32 i;
  PRInt32 j;

  START("20-40,72-99,105,107,110-111,117-200");

  FROB(205, 208);
  FROB(50, 70);
  FROB(0, 10);
  FROB(112, 113);
  FROB(101, 101);
  FROB(5, 75);
  FROB(103, 109);
  FROB(2, 20);
  FROB(1, 9999);

  END();


#undef START
#undef FROB
#undef END
}
示例#4
0
void XFE_PrefsProxiesViewDialog::initPage()
{
	XP_ASSERT(m_prefsDataProxiesView);

	PrefsDataProxiesView  *fep = m_prefsDataProxiesView;
	XFE_GlobalPrefs       *prefs = &fe_globalPrefs;
    char buf[1024];
    char* host;
    int port;

#define FROB(SLOT,SUFFIX,DEF)                               \
    host = prefs->SLOT##_##SUFFIX;                          \
    port = prefs->SLOT##_##SUFFIX##_port;                   \
    if ( port == 0 ) {                                      \
        strcpy(buf, DEF);                                   \
    } else {                                                \
	    sprintf(buf, "%d", port);                           \
    }                                                       \
	fe_SetTextField(fep->SLOT##_##SUFFIX##_text, host); \
	fe_SetTextField(fep->SLOT##_port_text, buf)

	FROB(ftp,      proxy, "");
    FROB(gopher,   proxy, "");
    FROB(http,     proxy, "");
#ifndef NO_SECURITY
    FROB(https,    proxy, "");
#endif
	FROB(wais,     proxy, "");
	FROB(socks,    host,  "1080");
#undef FROB
	
	XtSetSensitive(fep->ftp_proxy_text, !PREF_PrefIsLocked("network.proxy.ftp"));
	XtSetSensitive(fep->ftp_port_text, !PREF_PrefIsLocked("network.proxy.ftp_port"));
	XtSetSensitive(fep->gopher_proxy_text, !PREF_PrefIsLocked("network.proxy.gopher"));
	XtSetSensitive(fep->gopher_port_text, !PREF_PrefIsLocked("network.proxy.gopher_port"));
	XtSetSensitive(fep->http_proxy_text, !PREF_PrefIsLocked("network.proxy.http"));
	XtSetSensitive(fep->http_port_text, !PREF_PrefIsLocked("network.proxy.http_port"));
	XtSetSensitive(fep->https_proxy_text, !PREF_PrefIsLocked("network.proxy.ssl"));
	XtSetSensitive(fep->https_port_text, !PREF_PrefIsLocked("network.proxy.ssl_port"));
	XtSetSensitive(fep->wais_proxy_text, !PREF_PrefIsLocked("network.proxy.wais"));
	XtSetSensitive(fep->wais_port_text, !PREF_PrefIsLocked("network.proxy.wais_port"));
	XtSetSensitive(fep->no_proxy_text, !PREF_PrefIsLocked("network.proxy.no_proxies_on"));
	XtSetSensitive(fep->socks_host_text, !PREF_PrefIsLocked("network.hosts.socks_server"));
	XtSetSensitive(fep->socks_port_text, !PREF_PrefIsLocked("network.hosts.socks_serverport"));

	fe_SetTextField(fep->no_proxy_text, prefs->no_proxy);
}
示例#5
0
文件: wrap.c 项目: simbasailor/sbcl
static void
copy_to_stat_wrapper(struct stat_wrapper *to, struct stat *from)
{
#define FROB(stem) to->wrapped_st_##stem = from->st_##stem
#ifndef LISP_FEATURE_WIN32
#define FROB2(stem) to->wrapped_st_##stem = from->st_##stem
#else
#define FROB2(stem) to->wrapped_st_##stem = 0;
#endif
    FROB(dev);
    FROB2(ino);
    FROB(mode);
    FROB(nlink);
    FROB2(uid);
    FROB2(gid);
    FROB(rdev);
    FROB(size);
    FROB2(blksize);
    FROB2(blocks);
    FROB(atime);
    FROB(mtime);
    FROB(ctime);
#undef FROB
}
示例#6
0
void
nsMsgKeySet::test_adder (void)
{
  const char *string;
  nsMsgKeySet *set;
  char *s;
  PRInt32 i;

  START("0-70,72-99,105,107,110-111,117-200");

  FROB(205, true);
  FROB(206, true);
  FROB(207, true);
  FROB(208, true);
  FROB(208, true);
  FROB(109, true);
  FROB(72, true);

  FROB(205, false);
  FROB(206, false);
  FROB(207, false);
  FROB(208, false);
  FROB(208, false);
  FROB(109, false);
  FROB(72, false);

  FROB(72, true);
  FROB(109, true);
  FROB(208, true);
  FROB(208, true);
  FROB(207, true);
  FROB(206, true);
  FROB(205, true);

  FROB(205, false);
  FROB(206, false);
  FROB(207, false);
  FROB(208, false);
  FROB(208, false);
  FROB(109, false);
  FROB(72, false);

  FROB(100, true);
  FROB(101, true);
  FROB(102, true);
  FROB(103, true);
  FROB(106, true);
  FROB(104, true);
  FROB(109, true);
  FROB(108, true);
  END();

  START("1-6"); FROB(7, false); END();
  START("1-6"); FROB(6, false); END();
  START("1-6"); FROB(5, false); END();
  START("1-6"); FROB(4, false); END();
  START("1-6"); FROB(3, false); END();
  START("1-6"); FROB(2, false); END();
  START("1-6"); FROB(1, false); END();
  START("1-6"); FROB(0, false); END();

  START("1-3"); FROB(1, false); END();
  START("1-3"); FROB(2, false); END();
  START("1-3"); FROB(3, false); END();

  START("1,3,5-7,9,10"); FROB(5, false); END();
  START("1,3,5-7,9,10"); FROB(6, false); END();
  START("1,3,5-7,9,10"); FROB(7, false); FROB(7, true); FROB(8, true);
  FROB (4, true); FROB (2, false); FROB (2, true);

  FROB (4, false); FROB (5, false); FROB (6, false); FROB (7, false);
  FROB (8, false); FROB (9, false); FROB (10, false); FROB (3, false);
  FROB (2, false); FROB (1, false); FROB (1, false); FROB (0, false);
  END();
}
示例#7
0
JSBool
js_InitPinnedAtoms(JSContext *cx, JSAtomState *state)
{
    uintN i;

#define FROB(lval,str)                                                        \
    JS_BEGIN_MACRO                                                            \
        if (!(state->lval = js_Atomize(cx, str, strlen(str), ATOM_PINNED)))   \
            return JS_FALSE;                                                  \
    JS_END_MACRO

    JS_ASSERT(sizeof js_type_str / sizeof js_type_str[0] == JSTYPE_LIMIT);
    for (i = 0; i < JSTYPE_LIMIT; i++)
        FROB(typeAtoms[i],        js_type_str[i]);

    FROB(booleanAtoms[0],         js_false_str);
    FROB(booleanAtoms[1],         js_true_str);
    FROB(nullAtom,                js_null_str);

    FROB(ArgumentsAtom,           js_Arguments_str);
    FROB(ArrayAtom,               js_Array_str);
    FROB(BooleanAtom,             js_Boolean_str);
    FROB(CallAtom,                js_Call_str);
    FROB(DateAtom,                js_Date_str);
    FROB(ErrorAtom,               js_Error_str);
    FROB(FunctionAtom,            js_Function_str);
    FROB(MathAtom,                js_Math_str);
    FROB(NumberAtom,              js_Number_str);
    FROB(ObjectAtom,              js_Object_str);
    FROB(RegExpAtom,              js_RegExp_str);
    FROB(ScriptAtom,              js_Script_str);
    FROB(StringAtom,              js_String_str);
    FROB(anonymousAtom,           js_anonymous_str);
    FROB(argumentsAtom,           js_arguments_str);
    FROB(arityAtom,               js_arity_str);
    FROB(calleeAtom,              js_callee_str);
    FROB(callerAtom,              js_caller_str);
    FROB(classPrototypeAtom,      js_class_prototype_str);
    FROB(constructorAtom,         js_constructor_str);
    FROB(countAtom,               js_count_str);
    FROB(evalAtom,                js_eval_str);
    FROB(getAtom,                 js_get_str);
    FROB(getterAtom,              js_getter_str);
    FROB(indexAtom,               js_index_str);
    FROB(inputAtom,               js_input_str);
    FROB(lengthAtom,              js_length_str);
    FROB(nameAtom,                js_name_str);
    FROB(parentAtom,              js_parent_str);
    FROB(protoAtom,               js_proto_str);
    FROB(setAtom,                 js_set_str);
    FROB(setterAtom,              js_setter_str);
    FROB(toSourceAtom,            js_toSource_str);
    FROB(toStringAtom,            js_toString_str);
    FROB(toLocaleStringAtom,      js_toLocaleString_str);
    FROB(valueOfAtom,             js_valueOf_str);

#undef FROB

    memset(&state->lazy, 0, sizeof state->lazy);
    return JS_TRUE;
}
示例#8
0
JSBool
js_InitAtomState(JSContext *cx, JSAtomState *state)
{
    uintN i;

    state->number = 0;
    state->table = PR_NewHashTable(JS_ATOM_HASH_SIZE, js_hash_atom_key,
				   js_compare_atom_keys, js_compare_stub,
				   &atomAllocOps, state);
    if (!state->table) {
	JS_ReportOutOfMemory(cx);
	return JS_FALSE;
    }

#define FROB(lval,str) {                                                      \
    if (!(state->lval = js_Atomize(cx, str, strlen(str), 0))) {               \
	js_FreeAtomState(cx, state);                                          \
	return JS_FALSE;                                                      \
    }                                                                         \
}

    PR_ASSERT(sizeof js_type_str / sizeof js_type_str[0] == JSTYPE_LIMIT);
    for (i = 0; i < JSTYPE_LIMIT; i++)
	FROB(typeAtoms[i],        js_type_str[i]);

    FROB(booleanAtoms[0],         js_false_str);
    FROB(booleanAtoms[1],         js_true_str);
    FROB(nullAtom,                js_null_str);

    FROB(ArrayAtom,               js_Array_str);
    FROB(ObjectAtom,              js_Object_str);
    FROB(anonymousAtom,           js_anonymous_str);
    FROB(assignAtom,              js_assign_str);
    FROB(classPrototypeAtom,      js_class_prototype_str);
    FROB(constructorAtom,         js_constructor_str);
    FROB(countAtom,               js_count_str);
    FROB(indexAtom,               js_index_str);
    FROB(inputAtom,               js_input_str);
    FROB(lengthAtom,              js_length_str);
    FROB(parentAtom,              js_parent_str);
    FROB(protoAtom,               js_proto_str);
    FROB(toStringAtom,            js_toString_str);
    FROB(valueOfAtom,             js_valueOf_str);

#undef FROB

    return JS_TRUE;
}
示例#9
0
/* Initializes a new tentacle and stores it in the list.
 */
static tentacle *
make_tentacle (ModeInfo *mi, int which, int total)
{
    tentacles_configuration *tc = &tcs[MI_SCREEN(mi)];
    tentacle *t = (tentacle *) calloc (1, sizeof (*t));
    double brightness;
    int i;

    t->mi = mi;

    /* position tentacles on a grid */
    {
        int cols = (int) (sqrt(total) + 0.5);
        int rows = (total+cols-1) / cols;
        int xx = which % cols;
        int yy = which / cols;
        double spc = arg_thickness * 0.8;
        if (!intersect_p) cols = 1, xx = 0;
        t->x = (cols * spc / 2) - (spc * (xx + 0.5));
        t->y = (rows * spc / 2) - (spc * (yy + 0.5));
        t->z = 0;
    }

    /* Brighten or darken the colors of this tentacle from the default.
     */
    brightness = 0.6 + frand(3.0);
    memcpy (t->tentacle_color, tc->tentacle_color, 4 * sizeof(*t->tentacle_color));
    memcpy (t->stripe_color,   tc->stripe_color,   4 * sizeof(*t->stripe_color));
    memcpy (t->sucker_color,   tc->sucker_color,   4 * sizeof(*t->sucker_color));
# define FROB(X) \
    t->X[0] *= brightness; if (t->X[0] > 1) t->X[0] = 1; \
    t->X[1] *= brightness; if (t->X[1] > 1) t->X[1] = 1; \
    t->X[2] *= brightness; if (t->X[2] > 1) t->X[2] = 1
    FROB (tentacle_color);
    FROB (stripe_color);
    FROB (sucker_color);
# undef FROB

    t->nsegments = (arg_segments) + BELLRAND(arg_segments);

    t->segments = (segment *) calloc (t->nsegments+1, sizeof(*t->segments));
    for (i = 0; i < t->nsegments; i++)
    {
        double spin_speed   = 0;
        double spin_accel   = 0;
        double wander_speed = arg_speed * (0.02 + BELLRAND(0.1));
        t->segments[i].rot = make_rotator (spin_speed, spin_speed, spin_speed,
                                           spin_accel, wander_speed, True);
    }

    t->segments[0].thickness = (((arg_thickness * 0.5) +
                                 BELLRAND(arg_thickness * 0.6))
                                / 1.0);

    if (tc->tentacles_size <= tc->ntentacles)
    {
        tc->tentacles_size = (tc->tentacles_size * 1.2) + tc->ntentacles + 2;
        tc->tentacles = (tentacle **)
                        realloc (tc->tentacles, tc->tentacles_size * sizeof(*tc->tentacles));
        if (! tc->tentacles)
        {
            fprintf (stderr, "%s: out of memory (%d tentacles)\n",
                     progname, tc->tentacles_size);
            exit (1);
        }
    }

    tc->tentacles[tc->ntentacles++] = t;
    return t;
}
示例#10
0
static int
MimeExternalBody_parse_eof (MimeObject *obj, bool abort_p)
{
  int status = 0;
  MimeExternalBody *bod = (MimeExternalBody *) obj;

  if (obj->closed_p) return 0;

  /* Run parent method first, to flush out any buffered data. */
  status = ((MimeObjectClass*)&MIME_SUPERCLASS)->parse_eof(obj, abort_p);
  if (status < 0) return status;

#ifdef XP_MACOSX
  if (obj->parent && mime_typep(obj->parent,
                                (MimeObjectClass*) &mimeMultipartAppleDoubleClass))
    goto done;
#endif /* XP_MACOSX */

  if (!abort_p &&
      obj->output_p &&
      obj->options &&
      obj->options->write_html_p)
  {
    bool all_headers_p = obj->options->headers == MimeHeadersAll;
    MimeDisplayOptions *newopt = obj->options;  /* copy it */

    char *ct = MimeHeaders_get(obj->headers, HEADER_CONTENT_TYPE,
                               PR_FALSE, PR_FALSE);
    char *at, *lexp, *size, *perm;
    char *url, *dir, *mode, *name, *site, *svr, *subj;
    char *h = 0, *lname = 0, *lurl = 0, *body = 0;
    MimeHeaders *hdrs = 0;

    if (!ct) return MIME_OUT_OF_MEMORY;

    at   = MimeHeaders_get_parameter(ct, "access-type", NULL, NULL);
    lexp  = MimeHeaders_get_parameter(ct, "expiration", NULL, NULL);
    size = MimeHeaders_get_parameter(ct, "size", NULL, NULL);
    perm = MimeHeaders_get_parameter(ct, "permission", NULL, NULL);
    dir  = MimeHeaders_get_parameter(ct, "directory", NULL, NULL);
    mode = MimeHeaders_get_parameter(ct, "mode", NULL, NULL);
    name = MimeHeaders_get_parameter(ct, "name", NULL, NULL);
    site = MimeHeaders_get_parameter(ct, "site", NULL, NULL);
    svr  = MimeHeaders_get_parameter(ct, "server", NULL, NULL);
    subj = MimeHeaders_get_parameter(ct, "subject", NULL, NULL);
    url  = MimeHeaders_get_parameter(ct, "url", NULL, NULL);
    PR_FREEIF(ct);

    /* the *internal* content-type */
    ct = MimeHeaders_get(bod->hdrs, HEADER_CONTENT_TYPE,
                         PR_TRUE, PR_FALSE);
						 
    PRUint32 hlen = ((at ? strlen(at) : 0) +
                    (lexp ? strlen(lexp) : 0) +
                    (size ? strlen(size) : 0) +
                    (perm ? strlen(perm) : 0) +
                    (dir ? strlen(dir) : 0) +
                    (mode ? strlen(mode) : 0) +
                    (name ? strlen(name) : 0) +
                    (site ? strlen(site) : 0) +
                    (svr ? strlen(svr) : 0) +
                    (subj ? strlen(subj) : 0) +
                    (ct ? strlen(ct) : 0) +
                    (url ? strlen(url) : 0) + 100);
					
	h = (char *) PR_MALLOC(hlen);
    if (!h)
    {
      status = MIME_OUT_OF_MEMORY;
      goto FAIL;
    }

    /* If there's a URL parameter, remove all whitespace from it.
      (The URL parameter to one of these headers is stored with
       lines broken every 40 characters or less; it's assumed that
       all significant whitespace was URL-hex-encoded, and all the
       rest of it was inserted just to keep the lines short.)
      */
    if (url)
    {
      char *in, *out;
      for (in = url, out = url; *in; in++)
        if (!IS_SPACE(*in))
          *out++ = *in;
      *out = 0;
    }

    hdrs = MimeHeaders_new();
    if (!hdrs)
    {
      status = MIME_OUT_OF_MEMORY;
      goto FAIL;
    }

# define FROB(STR,VAR) \
    if (VAR) \
    { \
      PL_strncpyz(h, STR ": ", hlen); \
        PL_strcatn(h, hlen, VAR); \
          PL_strcatn(h, hlen, MSG_LINEBREAK); \
            status = MimeHeaders_parse_line(h, strlen(h), hdrs); \
              if (status < 0) goto FAIL; \
    }
    FROB("Access-Type",  at);
    FROB("URL",      url);
    FROB("Site",      site);
    FROB("Server",    svr);
    FROB("Directory",    dir);
    FROB("Name",      name);
    FROB("Type",      ct);
    FROB("Size",      size);
    FROB("Mode",      mode);
    FROB("Permission",  perm);
    FROB("Expiration",  lexp);
    FROB("Subject",    subj);
# undef FROB
    PL_strncpyz(h, MSG_LINEBREAK, hlen);
    status = MimeHeaders_parse_line(h, strlen(h), hdrs);
    if (status < 0) goto FAIL;

    lurl = MimeExternalBody_make_url(ct, at, lexp, size, perm, dir, mode,
                                     name, url, site, svr, subj, bod->body);
    if (lurl)
    {
      lname = MimeGetStringByID(MIME_MSG_LINK_TO_DOCUMENT);
    }
    else
    {
      lname = MimeGetStringByID(MIME_MSG_DOCUMENT_INFO);
      all_headers_p = PR_TRUE;
    }

    all_headers_p = PR_TRUE;  /* #### just do this all the time? */

    if (bod->body && all_headers_p)
    {
      char *s = bod->body;
      while (IS_SPACE(*s)) s++;
      if (*s)
      {
        char *s2;
        const char *pre = "<P><PRE>";
        const char *suf = "</PRE>";
        PRInt32 i;
        for(i = strlen(s)-1; i >= 0 && IS_SPACE(s[i]); i--)
          s[i] = 0;
        s2 = MsgEscapeHTML(s);
        if (!s2) goto FAIL;
        body = (char *) PR_MALLOC(strlen(pre) + strlen(s2) +
                                  strlen(suf) + 1);
        if (!body)
        {
          NS_Free(s2);
          goto FAIL;
        }
        PL_strcpy(body, pre);
        PL_strcat(body, s2);
        PL_strcat(body, suf);
      }
    }

    newopt->fancy_headers_p = PR_TRUE;
    newopt->headers = (all_headers_p ? MimeHeadersAll : MimeHeadersSome);

FAIL:
      if (hdrs)
        MimeHeaders_free(hdrs);
    PR_FREEIF(h);
    PR_FREEIF(lname);
    PR_FREEIF(lurl);
    PR_FREEIF(body);
    PR_FREEIF(ct);
    PR_FREEIF(at);
    PR_FREEIF(lexp);
    PR_FREEIF(size);
    PR_FREEIF(perm);
    PR_FREEIF(dir);
    PR_FREEIF(mode);
    PR_FREEIF(name);
    PR_FREEIF(url);
    PR_FREEIF(site);
    PR_FREEIF(svr);
    PR_FREEIF(subj);
  }

#ifdef XP_MACOSX
done:
#endif

    return status;
}
示例#11
0
static Lisp_Object
mswindows_device_system_metrics (struct device *d,
				 enum device_metrics m)
{
  const HDC hdc = DEVICE_MSWINDOWS_HCDC(d);

  switch (m)
    {
    case DM_size_device:
      return Fcons (make_fixnum (GetDeviceCaps (hdc, HORZRES)),
		    make_fixnum (GetDeviceCaps (hdc, VERTRES)));
      break;
    case DM_device_dpi:
      return Fcons (make_fixnum (GetDeviceCaps (hdc, LOGPIXELSX)),
		    make_fixnum (GetDeviceCaps (hdc, LOGPIXELSY)));
      break;
    case DM_size_device_mm:
      return Fcons (make_fixnum (GetDeviceCaps (hdc, HORZSIZE)),
		    make_fixnum (GetDeviceCaps (hdc, VERTSIZE)));
      break;
    case DM_num_bit_planes:
      /* this is what X means by bitplanes therefore we ought to be
         consistent. num planes is always 1 under mswindows and
         therefore useless */
      return make_fixnum (GetDeviceCaps (hdc, BITSPIXEL));
      break;
    case DM_num_color_cells:
      /* #### SIZEPALETTE only valid if RC_PALETTE bit set in RASTERCAPS,
         what should we return for a non-palette-based device? */
      return make_fixnum (GetDeviceCaps (hdc, SIZEPALETTE));
      break;

      /*** Colors ***/
#define FROB(met, fore, back)				\
    case DM_##met:					\
      return build_syscolor_cons (fore, back);

      FROB (color_default, COLOR_WINDOWTEXT, COLOR_WINDOW);
      FROB (color_select, COLOR_HIGHLIGHTTEXT, COLOR_HIGHLIGHT);
      FROB (color_balloon, COLOR_INFOTEXT, COLOR_INFOBK);
      FROB (color_3d_face, COLOR_BTNTEXT, COLOR_BTNFACE);
      FROB (color_3d_light, COLOR_3DHILIGHT, COLOR_3DLIGHT);
      FROB (color_3d_dark, COLOR_3DDKSHADOW, COLOR_3DSHADOW);
      FROB (color_menu, COLOR_MENUTEXT, COLOR_MENU);
      FROB (color_menu_highlight, COLOR_HIGHLIGHTTEXT, COLOR_HIGHLIGHT);
      FROB (color_menu_button, COLOR_MENUTEXT, COLOR_MENU);
      FROB (color_menu_disabled, COLOR_GRAYTEXT, COLOR_MENU);
      FROB (color_toolbar, COLOR_BTNTEXT, COLOR_BTNFACE);
      FROB (color_scrollbar, COLOR_CAPTIONTEXT, COLOR_SCROLLBAR);
      FROB (color_desktop, -1, COLOR_DESKTOP);
      FROB (color_workspace, -1, COLOR_APPWORKSPACE);
#undef FROB

      /*** Sizes ***/
#define FROB(met, index1, index2)			\
    case DM_##met:					\
      return build_sysmetrics_cons (index1, index2);

      FROB (size_cursor, SM_CXCURSOR, SM_CYCURSOR);
      FROB (size_scrollbar, SM_CXVSCROLL, SM_CYHSCROLL);
      FROB (size_menu, -1, SM_CYMENU);
      FROB (size_icon, SM_CXICON, SM_CYICON);
      FROB (size_icon_small, SM_CXSMICON, SM_CYSMICON);
#undef FROB

    case DM_size_workspace:
      {
	RECT rc;
	mswindows_get_workspace_coords (&rc);
	return Fcons (make_fixnum (rc.right - rc.left),
		      make_fixnum (rc.bottom - rc.top));
      }

    case DM_offset_workspace:
      {
	RECT rc;
	mswindows_get_workspace_coords (&rc);
	return Fcons (make_fixnum (rc.left), make_fixnum (rc.top));
      }

      /*
	case DM_size_toolbar:
	case DM_size_toolbar_button:
	case DM_size_toolbar_border:
      */

      /*** Features ***/
#define FROB(met, index)			\
    case DM_##met:				\
      return make_fixnum (GetSystemMetrics (index));

      FROB (mouse_buttons, SM_CMOUSEBUTTONS);
      FROB (swap_buttons, SM_SWAPBUTTON);
      FROB (show_sounds, SM_SHOWSOUNDS);
      FROB (slow_device, SM_SLOWMACHINE);
      FROB (security, SM_SECURE);
#undef FROB

    }

  /* Do not know such property */
  return Qunbound;
}
示例#12
0
void describe_gc_cache(struct gc_cache *cache)
{
	int count = 0;
	struct gc_cache_cell *cell = cache->head;
	stderr_out("\nsize:    %d", cache->size);
	stderr_out("\ncreated: %d", cache->create_count);
	stderr_out("\ndeleted: %d", cache->delete_count);
	while (cell) {
		struct gc_cache_cell *cell2;
		int i = 0;
		stderr_out("\n%d:\t0x%lx  GC: 0x%08lx  hash: 0x%08lx\n",
			   count, (long)cell, (long)cell->gc,
			   gc_cache_hash(&cell->gcvm));
		for (cell2 = cache->head; cell2; cell2 = cell2->next, i++)
			if (count != i &&
			    gc_cache_hash(&cell->gcvm) ==
			    gc_cache_hash(&cell2->gcvm))
				stderr_out("\tHASH COLLISION with cell %d\n",
					   i);
		stderr_out("\tmask:       %8lx\n", cell->gcvm.mask);

#define FROB(field) do {						\
  if ((int)cell->gcvm.gcv.field != (~0))				\
    stderr_out ("\t%-12s%8x\n", #field ":", (int)cell->gcvm.gcv.field);	\
} while (0)
		FROB(function);
		FROB(plane_mask);
		FROB(foreground);
		FROB(background);
		FROB(line_width);
		FROB(line_style);
		FROB(cap_style);
		FROB(join_style);
		FROB(fill_style);
		FROB(fill_rule);
		FROB(arc_mode);
		FROB(tile);
		FROB(stipple);
		FROB(ts_x_origin);
		FROB(ts_y_origin);
		FROB(font);
		FROB(subwindow_mode);
		FROB(graphics_exposures);
		FROB(clip_x_origin);
		FROB(clip_y_origin);
		FROB(clip_mask);
		FROB(dash_offset);
#undef FROB

		count++;
		if (cell->next && cell == cache->tail)
			stderr_out("\nERROR!  tail is here!\n\n");
		else if (!cell->next && cell != cache->tail)
			stderr_out("\nERROR!  tail is not at the end\n\n");
		cell = cell->next;
	}
	if (count != cache->size)
		stderr_out("\nERROR!  count should be %d\n\n", cache->size);
}
示例#13
0
void
nsMsgKeySet::test_adder (void)
{
    const char *string;
    nsMsgKeySet *set;
    char *s;
    PRInt32 i;

    START("0-70,72-99,105,107,110-111,117-200");

    FROB(205, PR_TRUE);
    FROB(206, PR_TRUE);
    FROB(207, PR_TRUE);
    FROB(208, PR_TRUE);
    FROB(208, PR_TRUE);
    FROB(109, PR_TRUE);
    FROB(72, PR_TRUE);

    FROB(205, PR_FALSE);
    FROB(206, PR_FALSE);
    FROB(207, PR_FALSE);
    FROB(208, PR_FALSE);
    FROB(208, PR_FALSE);
    FROB(109, PR_FALSE);
    FROB(72, PR_FALSE);

    FROB(72, PR_TRUE);
    FROB(109, PR_TRUE);
    FROB(208, PR_TRUE);
    FROB(208, PR_TRUE);
    FROB(207, PR_TRUE);
    FROB(206, PR_TRUE);
    FROB(205, PR_TRUE);

    FROB(205, PR_FALSE);
    FROB(206, PR_FALSE);
    FROB(207, PR_FALSE);
    FROB(208, PR_FALSE);
    FROB(208, PR_FALSE);
    FROB(109, PR_FALSE);
    FROB(72, PR_FALSE);

    FROB(100, PR_TRUE);
    FROB(101, PR_TRUE);
    FROB(102, PR_TRUE);
    FROB(103, PR_TRUE);
    FROB(106, PR_TRUE);
    FROB(104, PR_TRUE);
    FROB(109, PR_TRUE);
    FROB(108, PR_TRUE);
    END();

    START("1-6");
    FROB(7, PR_FALSE);
    END();
    START("1-6");
    FROB(6, PR_FALSE);
    END();
    START("1-6");
    FROB(5, PR_FALSE);
    END();
    START("1-6");
    FROB(4, PR_FALSE);
    END();
    START("1-6");
    FROB(3, PR_FALSE);
    END();
    START("1-6");
    FROB(2, PR_FALSE);
    END();
    START("1-6");
    FROB(1, PR_FALSE);
    END();
    START("1-6");
    FROB(0, PR_FALSE);
    END();

    START("1-3");
    FROB(1, PR_FALSE);
    END();
    START("1-3");
    FROB(2, PR_FALSE);
    END();
    START("1-3");
    FROB(3, PR_FALSE);
    END();

    START("1,3,5-7,9,10");
    FROB(5, PR_FALSE);
    END();
    START("1,3,5-7,9,10");
    FROB(6, PR_FALSE);
    END();
    START("1,3,5-7,9,10");
    FROB(7, PR_FALSE);
    FROB(7, PR_TRUE);
    FROB(8, PR_TRUE);
    FROB (4, PR_TRUE);
    FROB (2, PR_FALSE);
    FROB (2, PR_TRUE);

    FROB (4, PR_FALSE);
    FROB (5, PR_FALSE);
    FROB (6, PR_FALSE);
    FROB (7, PR_FALSE);
    FROB (8, PR_FALSE);
    FROB (9, PR_FALSE);
    FROB (10, PR_FALSE);
    FROB (3, PR_FALSE);
    FROB (2, PR_FALSE);
    FROB (1, PR_FALSE);
    FROB (1, PR_FALSE);
    FROB (0, PR_FALSE);
    END();
}
示例#14
0
文件: jsatom.c 项目: Kitiara/UOX3
JSBool
js_InitPinnedAtoms(JSContext *cx, JSAtomState *state)
{
    uintN i;

#define FROB(lval,str)                                                        \
    JS_BEGIN_MACRO                                                            \
        if (!(state->lval = js_Atomize(cx, str, strlen(str), ATOM_PINNED)))   \
            return JS_FALSE;                                                  \
    JS_END_MACRO

    JS_ASSERT(sizeof js_type_str / sizeof js_type_str[0] == JSTYPE_LIMIT);
    for (i = 0; i < JSTYPE_LIMIT; i++)
        FROB(typeAtoms[i],        js_type_str[i]);

    FROB(booleanAtoms[0],         js_false_str);
    FROB(booleanAtoms[1],         js_true_str);
    FROB(nullAtom,                js_null_str);

    FROB(ArgumentsAtom,           js_Arguments_str);
    FROB(ArrayAtom,               js_Array_str);
    FROB(BooleanAtom,             js_Boolean_str);
    FROB(CallAtom,                js_Call_str);
    FROB(DateAtom,                js_Date_str);
#if JS_HAS_ERROR_EXCEPTIONS
    FROB(ErrorAtom,               js_Error_str);
#endif
    FROB(FunctionAtom,            js_Function_str);
    FROB(MathAtom,                js_Math_str);
    FROB(NamespaceAtom,           js_Namespace_str);
    FROB(NumberAtom,              js_Number_str);
    FROB(ObjectAtom,              js_Object_str);
    FROB(QNameAtom,               js_QName_str);
    FROB(RegExpAtom,              js_RegExp_str);
    FROB(ScriptAtom,              js_Script_str);
    FROB(StringAtom,              js_String_str);
    FROB(XMLAtom,                 js_XML_str);
    FROB(FileAtom,                js_File_str);
    FROB(anonymousAtom,           js_anonymous_str);
    FROB(argumentsAtom,           js_arguments_str);
    FROB(arityAtom,               js_arity_str);
    FROB(calleeAtom,              js_callee_str);
    FROB(callerAtom,              js_caller_str);
    FROB(classPrototypeAtom,      js_class_prototype_str);
    FROB(constructorAtom,         js_constructor_str);
    FROB(countAtom,               js_count_str);
    FROB(eachAtom,                js_each_str);
    FROB(evalAtom,                js_eval_str);
    FROB(getAtom,                 js_get_str);
    FROB(getterAtom,              js_getter_str);
    FROB(indexAtom,               js_index_str);
    FROB(inputAtom,               js_input_str);
    FROB(lengthAtom,              js_length_str);
    FROB(nameAtom,                js_name_str);
    FROB(noSuchMethodAtom,        js_noSuchMethod_str);
    FROB(parentAtom,              js_parent_str);
    FROB(protoAtom,               js_proto_str);
    FROB(setAtom,                 js_set_str);
    FROB(setterAtom,              js_setter_str);
    FROB(toSourceAtom,            js_toSource_str);
    FROB(toStringAtom,            js_toString_str);
    FROB(toLocaleStringAtom,      js_toLocaleString_str);
    FROB(valueOfAtom,             js_valueOf_str);

#if JS_HAS_XML_SUPPORT
    FROB(etagoAtom,               js_etago_str);
    FROB(namespaceAtom,           js_namespace_str);
    FROB(ptagcAtom,               js_ptagc_str);
    FROB(qualifierAtom,           js_qualifier_str);
    FROB(spaceAtom,               js_space_str);
    FROB(stagoAtom,               js_stago_str);
    FROB(starAtom,                js_star_str);
    FROB(starQualifierAtom,       js_starQualifier_str);
    FROB(tagcAtom,                js_tagc_str);
    FROB(xmlAtom,                 js_xml_str);
#endif

#ifdef NARCISSUS
    FROB(callAtom,                js_call_str);
    FROB(constructAtom,           js_construct_str);
    FROB(hasInstanceAtom,         js_hasInstance_str);
    FROB(ExecutionContextAtom,    js_ExecutionContext_str);
    FROB(currentAtom,             js_current_str);
#endif

#undef FROB

    memset(&state->lazy, 0, sizeof state->lazy);
    return JS_TRUE;
}
示例#15
0
char *
html_decode_entities (const char *beg, const char *end)
{
    char *newstr = (char *)xmalloc (end - beg + 1); /* assume worst-case. */
    const char *from = beg;
    char *to = newstr;

    while (from < end)
    {
        if (*from != '&')
            *to++ = *from++;
        else
        {
            const char *save = from;
            int remain;

            if (++from == end) goto lose;
            remain = end - from;

            if (*from == '#')
            {
                int numeric;
                ++from;
                if (from == end || !ISDIGIT (*from)) goto lose;
                for (numeric = 0; from < end && ISDIGIT (*from); from++)
                    numeric = 10 * numeric + (*from) - '0';
                if (from < end && ISALPHA (*from)) goto lose;
                numeric &= 0xff;
                *to++ = numeric;
            }
#define FROB(literal) (remain >= (sizeof (literal) - 1)			\
		 && !memcmp (from, literal, sizeof (literal) - 1)	\
		 && (*(from + sizeof (literal) - 1) == ';'		\
		     || remain == sizeof (literal) - 1			\
		     || !ISALNUM (*(from + sizeof (literal) - 1))))
            else if (FROB ("lt"))
                *to++ = '<', from += 2;
            else if (FROB ("gt"))
                *to++ = '>', from += 2;
            else if (FROB ("amp"))
                *to++ = '&', from += 3;
            else if (FROB ("quot"))
                *to++ = '\"', from += 4;
            /* We don't implement the "Added Latin 1" entities proposed
               by rfc1866 (except for nbsp), because it is unnecessary
               in the context of Wget, and would require hashing to work
               efficiently.  */
            else if (FROB ("nbsp"))
                *to++ = 160, from += 4;
            else
                goto lose;
#undef FROB
            /* If the entity was followed by `;', we step over the `;'.
               Otherwise, it was followed by either a non-alphanumeric
               or EOB, in which case we do nothing.  */
            if (from < end && *from == ';')
                ++from;
            continue;

lose:
            /* This was not an entity after all.  Back out.  */
            from = save;
            *to++ = *from++;
        }
    }
    *to++ = '\0';
    /* #### Should we try to do this: */
#if 0
    newstr = xrealloc (newstr, to - newstr);
#endif
    return newstr;
}