当前位置: 首页>>代码示例>>C++>>正文


C++ DEF函数代码示例

本文整理汇总了C++中DEF函数的典型用法代码示例。如果您正苦于以下问题:C++ DEF函数的具体用法?C++ DEF怎么用?C++ DEF使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了DEF函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: rbffi_DynamicLibrary_Init

void
rbffi_DynamicLibrary_Init(VALUE moduleFFI)
{
    LibraryClass = rb_define_class_under(moduleFFI, "DynamicLibrary", rb_cObject);
    rb_global_variable(&LibraryClass);
    SymbolClass = rb_define_class_under(LibraryClass, "Symbol", rbffi_PointerClass);
    rb_global_variable(&SymbolClass);

    rb_define_const(moduleFFI, "NativeLibrary", LibraryClass); // backwards compat library
    rb_define_alloc_func(LibraryClass, library_allocate);
    rb_define_singleton_method(LibraryClass, "open", library_open, 2);
    rb_define_singleton_method(LibraryClass, "last_error", library_dlerror, 0);
    rb_define_method(LibraryClass, "initialize", library_initialize, 2);
    rb_define_method(LibraryClass, "find_symbol", library_dlsym, 1);
    rb_define_method(LibraryClass, "find_function", library_dlsym, 1);
    rb_define_method(LibraryClass, "find_variable", library_dlsym, 1);
    rb_define_method(LibraryClass, "last_error", library_dlerror, 0);
    rb_define_attr(LibraryClass, "name", 1, 0);

    rb_define_alloc_func(SymbolClass, symbol_allocate);
    rb_undef_method(SymbolClass, "new");
    rb_define_method(SymbolClass, "inspect", symbol_inspect, 0);

#define DEF(x) rb_define_const(LibraryClass, "RTLD_" #x, UINT2NUM(RTLD_##x))
    DEF(LAZY);
    DEF(NOW);
    DEF(GLOBAL);
    DEF(LOCAL);

}
开发者ID:Flameeyes,项目名称:ffi,代码行数:30,代码来源:DynamicLibrary.c

示例2: bootstrap_error

js_val *
bootstrap_error()
{
  js_val *error = JSNFUNC(error_new, 1);
  js_val *prototype = JSOBJ();
  prototype->proto = fh->object_proto;

  // Error
  // -----

  // Properties
  DEF(error, "prototype", prototype);

  // Error.prototype
  // ---------------
  
  // Properties
  DEF(prototype, "constructor", JSNFUNC(error_new, 1));
  DEF(prototype, "name", JSSTR("Error"));
  DEF(prototype, "message", JSSTR(""));

  // Methods
  DEF(prototype, "toString", JSNFUNC(error_proto_to_string, 0));

  fh_attach_prototype(prototype, fh->function_proto);

  return error;
}
开发者ID:pstef,项目名称:flathead,代码行数:28,代码来源:Error.c

示例3: DEF

static void DEF(ff_put_no_rnd_pixels16_y2)(uint8_t *block,
                                           const uint8_t *pixels,
                                           ptrdiff_t line_size, int h)
{
    DEF(ff_put_no_rnd_pixels8_y2)(block,     pixels,     line_size, h);
    DEF(ff_put_no_rnd_pixels8_y2)(block + 8, pixels + 8, line_size, h);
}
开发者ID:DonDiego,项目名称:libav,代码行数:7,代码来源:dsputil_avg_template.c

示例4: GenRSDataTypeEnums

// -gen-rs-data-type-enums
//
// ENUM_PRIMITIVE_DATA_TYPE(type, cname, bits)
// ENUM_PRIMITIVE_DATA_TYPE_RANGE(begin_type, end_type)
// ENUM_RS_MATRIX_DATA_TYPE(type, cname, bits)
// ENUM_RS_MATRIX_DATA_TYPE_RANGE(begin_type, end_type)
// ENUM_RS_OBJECT_DATA_TYPE(type, cname, bits)
// ENUM_RS_OBJECT_DATA_TYPE_RANGE(begin_type, end_type)
//
// ENUM_RS_DATA_TYPE(type, cname, bits)
// e.g., ENUM_RS_DATA_TYPE(Float32, "float", 256)
static int GenRSDataTypeEnums(const RSDataTypeSpec *const DataTypes[],
                              unsigned NumDataTypes) {
  // Alias missing #define
#define ALIAS_DEF(x, y) \
  printf("#ifndef " #x "\n");  \
  printf("#define " #x "(type, cname, bits) " #y "(type, cname, bits)\n");  \
  printf("#endif\n\n")
  ALIAS_DEF(ENUM_PRIMITIVE_DATA_TYPE, ENUM_RS_DATA_TYPE);
  ALIAS_DEF(ENUM_RS_MATRIX_DATA_TYPE, ENUM_RS_DATA_TYPE);
  ALIAS_DEF(ENUM_RS_OBJECT_DATA_TYPE, ENUM_RS_DATA_TYPE);
#undef ALIAS_DEF

#define ALIAS_DEF(x) \
  printf("#ifndef " #x "\n");  \
  printf("#define " #x "(begin_type, end_type)\n");  \
  printf("#endif\n\n")
  ALIAS_DEF(ENUM_PRIMITIVE_DATA_TYPE_RANGE);
  ALIAS_DEF(ENUM_RS_MATRIX_DATA_TYPE_RANGE);
  ALIAS_DEF(ENUM_RS_OBJECT_DATA_TYPE_RANGE);
#undef ALIAS_DEF

#define DEF(x) \
  printf(#x "(%s, \"%s\", %lu)\n",  \
         DataTypes[i]->getTypeName(), \
         DataTypes[i]->getTypePragmaName(), \
         (unsigned long) DataTypes[i]->getSizeInBit());  // NOLINT(runtime/int)
#define DEF_RANGE(x, begin, end)  \
  printf(#x "(%s, %s)\n\n", \
         DataTypes[begin]->getTypeName(), \
         DataTypes[end]->getTypeName())
  for (unsigned i = FirstPrimitiveType; i <= LastPrimitiveType; i++)
    DEF(ENUM_PRIMITIVE_DATA_TYPE);
  DEF_RANGE(ENUM_PRIMITIVE_DATA_TYPE_RANGE,
            FirstPrimitiveType, LastPrimitiveType);
  for (unsigned i = FirstRSMatrixType; i <= LastRSMatrixType; i++)
    DEF(ENUM_RS_MATRIX_DATA_TYPE)
  DEF_RANGE(ENUM_RS_MATRIX_DATA_TYPE_RANGE,
            FirstRSMatrixType, LastRSMatrixType);
  for (unsigned i = FirstRSObjectType; i <= LastRSObjectType; i++)
    DEF(ENUM_RS_OBJECT_DATA_TYPE)
  DEF_RANGE(ENUM_RS_OBJECT_DATA_TYPE_RANGE,
            FirstRSObjectType, LastRSObjectType);
#undef DEF
#undef DEF_RANGE

#define UNDEF(x)  \
  printf("#undef " #x "\n")
  UNDEF(ENUM_PRIMITIVE_DATA_TYPE);
  UNDEF(ENUM_RS_MATRIX_DATA_TYPE);
  UNDEF(ENUM_RS_OBJECT_DATA_TYPE);
  UNDEF(ENUM_PRIMITIVE_DATA_TYPE_RANGE);
  UNDEF(ENUM_RS_MATRIX_DATA_TYPE_RANGE);
  UNDEF(ENUM_RS_OBJECT_DATA_TYPE_RANGE);
  UNDEF(ENUM_RS_DATA_TYPE);
  return 0;
}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_frameworks_compile_slang,代码行数:67,代码来源:slang_rs_spec_table.cpp

示例5: alias_used_builtins

alias_used_builtins ()
{
  int rule, one_builtin_used = false;
  brother = laststdpred;
  for (builtin = laststdpred; builtin != nil; builtin = BROTHER (builtin))
    if ((builtin != cut) && (builtin != nestarset) &&
        (!mystrcmp (REPR (builtin), "select")) &&
        (builtin != tltraditionalterm) &&
        (builtin != transformlatticeterm) &&
        (builtin != tltraditional) &&
        (builtin != transformlattice) &&
        (builtin != skip) &&
        (builtin != explintersect) &&
        (builtin != getip) &&
        (builtin != falseip) &&
        (builtin != restoreip) &&
        (builtin != evalmeta) &&
        (builtin != initmeta) &&
        (builtin != evalmeta) && (builtin != resetinputptr) && (builtin != nestaralt) && (builtin != where))
    {
      int mem, alt;
      char *n, *m = REPR (builtin);
      if (!builtin_used ())
        continue;
      one_builtin_used = true;
      if (det_flag)
        if ((builtin == tltraditional) || (builtin == tltraditionalterm)
            || (mystrcmp (REPR (builtin), "select")) || (mystrcmp (REPR (builtin), "delete")))
          continue;
      make_new_rule (brother);
      new_rule = brother;

      n = (char *) malloc (strlen (m) + 7);
      if (n == NULL)
        fprintf (stderr, "glammar: Out of memory.\n"), exit (-1);
      strcpy (n, "built_"), strcpy (n + 6, m);
      REPR (new_rule) = n;
      SET (new_rule, external);
      PART (new_rule) = PART (root);
      for (rule = root; rule != laststdpred; rule = BROTHER (rule))
        for (alt = SON (rule); alt != nil; alt = BROTHER (alt))
          for (mem = SON (alt); mem != nil; mem = BROTHER (mem))
            if ((builtin == DEF (mem)) && !(TERMINAL (mem)))
            {
              DEF (mem) = new_rule;
              REPR (mem) = n;
            }
    }
  if (!one_builtin_used)
    return;
  for (rule = root; BROTHER (rule) != laststdpred; rule = BROTHER (rule));
  BROTHER (rule) = new_rule;
}
开发者ID:glammar,项目名称:glammar,代码行数:53,代码来源:gg09.c

示例6: bootstrap_function

js_val *
bootstrap_function()
{
  js_val *function = JSNFUNC(func_new, 1);
  js_val *prototype = JSFUNC(NULL);
  function->proto = prototype;
  prototype->proto = fh->object_proto;

  // Function
  // --------

  DEF(function, "prototype", prototype);

  // Function.prototype
  // ------------------

  // Properties
  DEF(prototype, "length", JSNUM(0));
  DEF(prototype, "constructor", JSNFUNC(func_new, 1));

  // Methods
  DEF(prototype, "apply", JSNFUNC(func_proto_apply, 2));
  DEF(prototype, "bind", JSNFUNC(func_proto_bind, 1));
  DEF(prototype, "call", JSNFUNC(func_proto_call, 1));
  DEF(prototype, "isGenerator", JSNFUNC(func_proto_is_generator, 0));
  DEF(prototype, "toString", JSNFUNC(func_proto_to_string, 0));

  fh->function_proto = prototype;

  return function;
}
开发者ID:ndreynolds,项目名称:flathead,代码行数:31,代码来源:Function.c

示例7: tail_recursion_elimination

tail_recursion_elimination ()
{
  int alt;
  int tre = 0;

  if (no_recursion_elm_flag)
    return false;

  for (alt = SON (ulhs); alt != nil; alt = BROTHER (alt))
  {
    int mem = SON (alt);
    if (mem == nil)
      continue;
    if (FLAG_MARKED (alt, no_tail_recursion_opt_f))
      continue;
    mem = get_last_but_cut_mem (mem);
    if (DEF (mem) == ulhs)
    {
      FLAG_SET (alt, tail_recursion_opt_f);
      FLAG_SET (mem, tail_recursion_opt_f);
      tre = 1;
    }
  }
  return tre;
}
开发者ID:glammar,项目名称:glammar,代码行数:25,代码来源:gg11.c

示例8: DEF

void Native::install_methods(Class *c)
{
	DEF(c, "repr")
		Native *n = static_cast<Native*>(self.obj);
		std::stringstream ss;
		ss << "<Native:" << (void*)self.obj << "/" << (void*)n->fn << ">";
		return ctx->make_string(ss.str());
	END
}
开发者ID:gnar,项目名称:zombo,代码行数:9,代码来源:Native.cpp

示例9: builtin_used

builtin_used ()
{
  int rule, alt, mem;
  for (rule = root; rule != laststdpred; rule = BROTHER (rule))
    for (alt = SON (rule); alt != nil; alt = BROTHER (alt))
      for (mem = SON (alt); mem != nil; mem = BROTHER (mem))
        if ((builtin == DEF (mem)) && !(TERMINAL (mem)))
          return true;
  return false;
}
开发者ID:glammar,项目名称:glammar,代码行数:10,代码来源:gg09.c

示例10: det_rule_head

det_rule_head ()
{
  fprintf (output, "\n\n/*  %s   */\n", FREPR (ulhs));
  if (MARKED (ulhs, external))
    fprintf (output, "int D%s(", REPR (ulhs));
  else
    fprintf (output, "static int D_%d(", ulhs);
  det_get_affixes (AFFIXDEF (SON (ulhs)));

  if (fprintf (output, " {\n register AFFIX raf = af;\n") == EOF)
  {
    fprintf (stderr, "glammar: Write failed (try again later)\n");
    exit (12);
  }
  if (BROTHER (SON (ulhs)) != nil)
  {
    fprintf (output, "  char *rc = c,  *rip = ip;\n");
  }
  if (lookahead_in_alt (SON (ulhs)))
    fprintf (output, "  char *lkh;\n");
  if (BROTHER (SON (ulhs)) != nil)
    fprintf (output, "  int cut_set = 0;\n");
  fprintf (output, "  int ltr=level++;\n");
  if (trace_flag)
    fprintf (output, " char *pntnamesv = pntname; char *ntname = \"%s\";\n", FREPR (ulhs));
  else if (errormsg_flag)
  {
    int mem = SON (SON (ulhs));
    if (mem != nil && DEF (mem) == equal)
      fprintf (output, "  char *pntnamesv = pntname; char *ntname = \"%s\"; int lsave = level+10;\n", FREPR (ulhs));
    else
      fprintf (output, "  char *pntnamesv = pntname; char *ntname = \"%s\"; int lsave = level++;\n", FREPR (ulhs));
  }

  if (stat_flag)
  {
    fprintf (output, "  int s1 = stat_count++;\n");
  }
  save_lattice_afx ();
  if (tail_recursion_elimination ())
    fprintf (output, " label_%d:\n\n", ulhs);

}
开发者ID:glammar,项目名称:glammar,代码行数:43,代码来源:gg11.c

示例11: mail_storage_settings_check

#include "mail-storage-private.h"
#include "mail-storage-settings.h"

#include <stddef.h>

static bool mail_storage_settings_check(void *_set, pool_t pool, const char **error_r);
static bool namespace_settings_check(void *_set, pool_t pool, const char **error_r);
static bool mailbox_settings_check(void *_set, pool_t pool, const char **error_r);
static bool mail_user_settings_check(void *_set, pool_t pool, const char **error_r);

#undef DEF
#define DEF(type, name) \
	{ type, #name, offsetof(struct mail_storage_settings, name), NULL }

static const struct setting_define mail_storage_setting_defines[] = {
	DEF(SET_STR_VARS, mail_location),
	{ SET_ALIAS, "mail", 0, NULL },
	DEF(SET_STR_VARS, mail_attachment_fs),
	DEF(SET_STR_VARS, mail_attachment_dir),
	DEF(SET_STR, mail_attachment_hash),
	DEF(SET_SIZE, mail_attachment_min_size),
	DEF(SET_STR_VARS, mail_attribute_dict),
	DEF(SET_UINT, mail_prefetch_count),
	DEF(SET_STR, mail_cache_fields),
	DEF(SET_STR, mail_never_cache_fields),
	DEF(SET_UINT, mail_cache_min_mail_count),
	DEF(SET_TIME, mailbox_idle_check_interval),
	DEF(SET_UINT, mail_max_keyword_length),
	DEF(SET_TIME, mail_max_lock_timeout),
	DEF(SET_TIME, mail_temp_scan_interval),
	DEF(SET_BOOL, mail_save_crlf),
开发者ID:bdraco,项目名称:dovecot,代码行数:31,代码来源:mail-storage-settings.c

示例12: DEF

#include "lib.h"
#include "settings-parser.h"
#include "master-service-private.h"
#include "master-service-ssl-settings.h"

#include <stddef.h>

#undef DEF
#define DEF(type, name) \
	{ type, #name, offsetof(struct master_service_ssl_settings, name), NULL }

static bool
master_service_ssl_settings_check(void *_set, pool_t pool, const char **error_r);

static const struct setting_define master_service_ssl_setting_defines[] = {
	DEF(SET_ENUM, ssl),
	DEF(SET_STR, ssl_ca),
	DEF(SET_STR, ssl_cert),
	DEF(SET_STR, ssl_key),
	DEF(SET_STR, ssl_key_password),
	DEF(SET_STR, ssl_cipher_list),
	DEF(SET_STR, ssl_protocols),
	DEF(SET_STR, ssl_cert_username_field),	
	DEF(SET_STR, ssl_crypto_device),
	DEF(SET_STR, ssl_cert_md_algorithm),
	DEF(SET_UINT, ssl_verify_depth),
	DEF(SET_BOOL, ssl_verify_client_cert),
	DEF(SET_BOOL, ssl_require_crl),
	DEF(SET_BOOL, verbose_ssl),
	DEF(SET_BOOL, ssl_prefer_server_ciphers),
	DEF(SET_BOOL, ssl_cert_info),
开发者ID:dhultin,项目名称:dovecot-pop-uidl-proxy,代码行数:31,代码来源:master-service-ssl-settings.c

示例13: sizeof

	.service_count = 1,
	.idle_kill = 0,
	.vsz_limit = (uoff_t)-1,

	.unix_listeners = ARRAY_INIT,
	.fifo_listeners = ARRAY_INIT,
	.inet_listeners = { { &managesieve_login_inet_listeners_buf,
		sizeof(managesieve_login_inet_listeners[0]) } }
};

#undef DEF
#define DEF(type, name) \
	{ type, #name, offsetof(struct managesieve_login_settings, name), NULL }

static const struct setting_define managesieve_login_setting_defines[] = {
	DEF(SET_STR, managesieve_implementation_string),
	DEF(SET_STR, managesieve_sieve_capability),
	DEF(SET_STR, managesieve_notify_capability),

	SETTING_DEFINE_LIST_END
};

static const struct managesieve_login_settings managesieve_login_default_settings = {
	.managesieve_implementation_string = DOVECOT_NAME " " PIGEONHOLE_NAME,
	.managesieve_sieve_capability = "",
	.managesieve_notify_capability = NULL
};

static const struct setting_parser_info *managesieve_login_setting_dependencies[] = {
	&login_setting_parser_info,
	NULL
开发者ID:unofficial-opensource-apple,项目名称:dovecot,代码行数:31,代码来源:managesieve-login-settings.c

示例14: DEF

/* Copyright (c) 2005-2016 Dovecot authors, see the included COPYING file */

#include "lib.h"
#include "settings-parser.h"
#include "mail-storage-settings.h"
#include "mbox-settings.h"

#include <stddef.h>

#undef DEF
#define DEF(type, name) \
	{ type, #name, offsetof(struct mbox_settings, name), NULL }

static const struct setting_define mbox_setting_defines[] = {
	DEF(SET_STR, mbox_read_locks),
	DEF(SET_STR, mbox_write_locks),
	DEF(SET_TIME, mbox_lock_timeout),
	DEF(SET_TIME, mbox_dotlock_change_timeout),
	DEF(SET_SIZE, mbox_min_index_size),
	DEF(SET_BOOL, mbox_dirty_syncs),
	DEF(SET_BOOL, mbox_very_dirty_syncs),
	DEF(SET_BOOL, mbox_lazy_writes),
	DEF(SET_ENUM, mbox_md5),

	SETTING_DEFINE_LIST_END
};

static const struct mbox_settings mbox_default_settings = {
	.mbox_read_locks = "fcntl",
	.mbox_write_locks = "dotlock fcntl",
	.mbox_lock_timeout = 5*60,
开发者ID:IvanKharpalev,项目名称:core,代码行数:31,代码来源:mbox-settings.c

示例15: x

void mt ## x(unsigned int data) \
{ \
	__asm volatile (STR(mt ## x %0) :: STR(r)(data)); \
} \

#define DEF(x) \
	{ #x, mf ## x, mt ## x }

FUNC(msr);

struct {
	char *op;
	unsigned int (*mf)(void);
	void (*mt)(unsigned int);
} mreg [] = {
	DEF(msr),
	{ NULL, NULL, NULL },
};

void
db_cmd_mf(int argc, char **argv)
{
	int i = 0;

	if (argc != 2) {
		printf("mf register\nregister:");
		while (mreg[i].op != NULL)
			printf(" %s", mreg[i++].op);
		printf("\n");
		return;
	}
开发者ID:ryo,项目名称:netbsd-src,代码行数:31,代码来源:monitor.c


注:本文中的DEF函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。