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


C++ Val_bool函数代码示例

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


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

示例1: PQres_isnull

CAMLprim value PQres_isnull(value v_res)
{
  return Val_bool(get_res(v_res) ? 0 : 1);
}
开发者ID:Nevor,项目名称:postgresql-ocaml,代码行数:4,代码来源:postgresql_stubs.c

示例2: caml_new_lex_engine

CAMLprim value caml_new_lex_engine(struct lexing_table *tbl, value start_state,
                                   struct lexer_buffer *lexbuf)
{
  int state, base, backtrk, c, pstate ;
  state = Int_val(start_state);
  if (state >= 0) {
    /* First entry */
    lexbuf->lex_last_pos = lexbuf->lex_start_pos = lexbuf->lex_curr_pos;
    lexbuf->lex_last_action = Val_int(-1);
  } else {
    /* Reentry after refill */
    state = -state - 1;
  }
  while(1) {
    /* Lookup base address or action number for current state */
    base = Short(tbl->lex_base, state);
    if (base < 0) {
      int pc_off = Short(tbl->lex_base_code, state) ;
      run_tag(Bp_val(tbl->lex_code) + pc_off, lexbuf->lex_mem);
      /*      fprintf(stderr,"Perform: %d\n",-base-1) ; */
      return Val_int(-base-1);
    }
    /* See if it's a backtrack point */
    backtrk = Short(tbl->lex_backtrk, state);
    if (backtrk >= 0) {
      int pc_off =  Short(tbl->lex_backtrk_code, state);
      run_tag(Bp_val(tbl->lex_code) + pc_off, lexbuf->lex_mem);
      lexbuf->lex_last_pos = lexbuf->lex_curr_pos;
      lexbuf->lex_last_action = Val_int(backtrk);

    }
    /* See if we need a refill */
    if (lexbuf->lex_curr_pos >= lexbuf->lex_buffer_len){
      if (lexbuf->lex_eof_reached == Val_bool (0)){
        return Val_int(-state - 1);
      }else{
        c = 256;
      }
    }else{
      /* Read next input char */
      c = Byte_u(lexbuf->lex_buffer, Long_val(lexbuf->lex_curr_pos));
      lexbuf->lex_curr_pos += 2;
    }
    /* Determine next state */
    pstate=state ;
    if (Short(tbl->lex_check, base + c) == state)
      state = Short(tbl->lex_trans, base + c);
    else
      state = Short(tbl->lex_default, state);
    /* If no transition on this char, return to last backtrack point */
    if (state < 0) {
      lexbuf->lex_curr_pos = lexbuf->lex_last_pos;
      if (lexbuf->lex_last_action == Val_int(-1)) {
        caml_failwith("lexing: empty token");
      } else {
        return lexbuf->lex_last_action;
      }
    }else{
      /* If some transition, get and perform memory moves */
      int base_code = Short(tbl->lex_base_code, pstate) ;
      int pc_off ;
      if (Short(tbl->lex_check_code, base_code + c) == pstate)
        pc_off = Short(tbl->lex_trans_code, base_code + c) ;
      else
        pc_off = Short(tbl->lex_default_code, pstate) ;
      if (pc_off > 0)
        run_mem(Bp_val(tbl->lex_code) + pc_off, lexbuf->lex_mem,
                lexbuf->lex_curr_pos) ;
      /* Erase the EOF condition only if the EOF pseudo-character was
         consumed by the automaton (i.e. there was no backtrack above)
       */
      if (c == 256) lexbuf->lex_eof_reached = Val_bool (0);
    }
  }
}
开发者ID:dhil,项目名称:ocaml-effects,代码行数:75,代码来源:lexing.c

示例3: caml_ml_runtime_warnings_enabled

CAMLprim value caml_ml_runtime_warnings_enabled(value unit)
{
  CAMLassert (unit == Val_unit);
  return Val_bool(caml_runtime_warnings);
}
开发者ID:dhil,项目名称:ocaml-multicore,代码行数:5,代码来源:gc_ctrl.c

示例4: llvm_target_has_jit

/* Target.t -> bool */
CAMLprim value llvm_target_has_jit(LLVMTargetRef Target) {
  return Val_bool(LLVMTargetHasJIT(Target));
}
开发者ID:1995hnagamin,项目名称:llvm,代码行数:4,代码来源:target_ocaml.c

示例5: llvm_target_has_asm_backend

/* Target.t -> bool */
CAMLprim value llvm_target_has_asm_backend(LLVMTargetRef Target) {
  return Val_bool(LLVMTargetHasAsmBackend(Target));
}
开发者ID:1995hnagamin,项目名称:llvm,代码行数:4,代码来源:target_ocaml.c

示例6: pcre_config_utf8_stub

/* Returns boolean indicating UTF8-support */
CAMLprim value pcre_config_utf8_stub(value __unused v_unit)
{ return Val_bool(pcre_config_int(PCRE_CONFIG_UTF8)); }
开发者ID:DMClambo,项目名称:pfff,代码行数:3,代码来源:pcre_stubs.c

示例7: caml_backtrace_status

CAMLprim value caml_backtrace_status(value vunit)
{
  return Val_bool(caml_backtrace_active);
}
开发者ID:puppeh,项目名称:ocaml-sh4,代码行数:4,代码来源:backtrace.c

示例8: spoc_getCudaDevice

value spoc_getCudaDevice(value i)
{
	CAMLparam1(i);
	CAMLlocal4(general_info, cuda_info, specific_info, gc_info);
	CAMLlocal3(device,  maxT, maxG);
	int nb_devices;
	CUdevprop dev_infos;
	CUdevice dev;
	CUcontext ctx;
	CUstream queue[2];
	spoc_cu_context *spoc_ctx;
	//CUcontext gl_ctx;
	char infoStr[1024];
	int infoInt;
	size_t infoUInt;
	int major, minor;
	enum cudaError_enum cuda_error; 


	cuDeviceGetCount (&nb_devices);

	if ((Int_val(i)) > nb_devices)
		raise_constant(*caml_named_value("no_cuda_device")) ;


	CUDA_CHECK_CALL(cuDeviceGet(&dev, Int_val(i)));
	CUDA_CHECK_CALL(cuDeviceGetProperties(&dev_infos, dev));

	general_info = caml_alloc (9, 0);
	CUDA_CHECK_CALL(cuDeviceGetName(infoStr, sizeof(infoStr), dev));

	Store_field(general_info,0, copy_string(infoStr));//
	CUDA_CHECK_CALL(cuDeviceTotalMem(&infoUInt, dev));

	Store_field(general_info,1, Val_int(infoUInt));//
	Store_field(general_info,2, Val_int(dev_infos.sharedMemPerBlock));//
	Store_field(general_info,3, Val_int(dev_infos.clockRate));//
	Store_field(general_info,4, Val_int(dev_infos.totalConstantMemory));//
	CUDA_CHECK_CALL(cuDeviceGetAttribute(&infoInt, CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT, dev));
	Store_field(general_info,5, Val_int(infoInt));//
	CUDA_CHECK_CALL(cuDeviceGetAttribute(&infoInt, CU_DEVICE_ATTRIBUTE_ECC_ENABLED, dev));
	Store_field(general_info,6, Val_bool(infoInt));//
	Store_field(general_info,7, i);
	CUDA_CHECK_CALL(cuCtxCreate	(&ctx,
			CU_CTX_SCHED_BLOCKING_SYNC | CU_CTX_MAP_HOST,
			dev));
	spoc_ctx = malloc(sizeof(spoc_cl_context));
	spoc_ctx->ctx = ctx;
	CUDA_CHECK_CALL(cuStreamCreate(&queue[0], 0));
	CUDA_CHECK_CALL(cuStreamCreate(&queue[1], 0));
	spoc_ctx->queue[0] = queue[0];
	spoc_ctx->queue[1] = queue[1];
	Store_field(general_info,8, (value)spoc_ctx);
	CUDA_CHECK_CALL(cuCtxSetCurrent(ctx));


	cuda_info = caml_alloc(1, 0); //0 -> Cuda
	specific_info = caml_alloc(18, 0);

	cuDeviceComputeCapability(&major, &minor, dev);
	Store_field(specific_info,0, Val_int(major));//
	Store_field(specific_info,1, Val_int(minor));//
	Store_field(specific_info,2, Val_int(dev_infos.regsPerBlock));//
	Store_field(specific_info,3, Val_int(dev_infos.SIMDWidth));//
	Store_field(specific_info,4, Val_int(dev_infos.memPitch));//
	Store_field(specific_info,5, Val_int(dev_infos.maxThreadsPerBlock));//

	maxT = caml_alloc(3, 0);
	Store_field(maxT,0, Val_int(dev_infos.maxThreadsDim[0]));//
	Store_field(maxT,1, Val_int(dev_infos.maxThreadsDim[1]));//
	Store_field(maxT,2, Val_int(dev_infos.maxThreadsDim[2]));//
	Store_field(specific_info,6, maxT);

	maxG = caml_alloc(3, 0);
	Store_field(maxG,0, Val_int(dev_infos.maxGridSize[0]));//
	Store_field(maxG,1, Val_int(dev_infos.maxGridSize[1]));//
	Store_field(maxG,2, Val_int(dev_infos.maxGridSize[2]));//
	Store_field(specific_info,7, maxG);

	Store_field(specific_info,8, Val_int(dev_infos.textureAlign));//
	cuDeviceGetAttribute(&infoInt, CU_DEVICE_ATTRIBUTE_GPU_OVERLAP, dev);
	Store_field(specific_info,9, Val_bool(infoInt));//
	cuDeviceGetAttribute(&infoInt, CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT, dev);
	Store_field(specific_info,10, Val_bool(infoInt));//
	cuDeviceGetAttribute(&infoInt, CU_DEVICE_ATTRIBUTE_INTEGRATED, dev);
	Store_field(specific_info,11, Val_bool(infoInt));//
	cuDeviceGetAttribute(&infoInt, CU_DEVICE_ATTRIBUTE_CAN_MAP_HOST_MEMORY, dev);
	Store_field(specific_info,12, Val_bool(infoInt));//
	cuDeviceGetAttribute(&infoInt, CU_DEVICE_ATTRIBUTE_COMPUTE_MODE, dev);
	Store_field(specific_info,13, Val_int(infoInt));//
	cuDeviceGetAttribute(&infoInt, CU_DEVICE_ATTRIBUTE_CONCURRENT_KERNELS, dev);
	Store_field(specific_info,14, Val_bool(infoInt));//
	cuDeviceGetAttribute(&infoInt, CU_DEVICE_ATTRIBUTE_PCI_BUS_ID, dev);
	Store_field(specific_info,15, Val_int(infoInt));
	cuDeviceGetAttribute(&infoInt, CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID, dev);
	Store_field(specific_info,16, Val_int(infoInt));
	cuDriverGetVersion(&infoInt);
	Store_field(specific_info, 17, Val_int(infoInt));

	Store_field(cuda_info, 0, specific_info);
//.........这里部分代码省略.........
开发者ID:caizongchao,项目名称:SPOC,代码行数:101,代码来源:Spoc_cu.c

示例9: bap_disasm_predicate_is_supported_stub

/* noalloc */
value bap_disasm_predicate_is_supported_stub(value d, value p) {
    return Val_bool(bap_disasm_predicate_is_supported(Int_val(d), Pred_val(p)));
}
开发者ID:BinaryAnalysisPlatform,项目名称:bap,代码行数:4,代码来源:disasm_stubs.c

示例10: caml_sfRenderWindow_isOpen

CAMLextern_C value
caml_sfRenderWindow_isOpen(value win)
{
    return Val_bool(
        SfRenderWindow_val(win)->isOpen());
}
开发者ID:LorantK,项目名称:PC2R,代码行数:6,代码来源:SFRenderWindow_stub.cpp

示例11: llvm_initialize_native_target

/* unit -> bool */
CAMLprim value llvm_initialize_native_target(value Unit) {
  return Val_bool(LLVMInitializeNativeTarget());
}
开发者ID:32bitmicro,项目名称:llvm,代码行数:4,代码来源:executionengine_ocaml.c

示例12: c_win32_dial

value_t c_win32_dial (
   value_t _mt,
   value_t _entryName,
   value_t phoneNumber,
   value_t userName,
   value_t password,
   value_t domain,
   value_t callback ) 
{
   char			* entryName = String_val ( _entryName );
   int			mt = Bool_val ( _mt );
   DWORD 		dwRet;
   RASDIALPARAMS 	rdParams;
   HRASCONN 		hRasConn;
   CAMLparam5 ( mt, _entryName, phoneNumber, userName, password );
   CAMLxparam2 ( domain, callback );

   printf ( "Callback passed = 0x%08x, deref = 0x%08x\n",
	    (unsigned) callback, (unsigned)(*(void **)callback) );
   fflush ( stdout );
   
   hRasConn = NULL;
   rdParams.dwSize = sizeof(RASDIALPARAMS);
   lstrcpy(rdParams.szEntryName,   entryName );
   lstrcpy(rdParams.szPhoneNumber, String_val ( phoneNumber ) );
   lstrcpy(rdParams.szCallbackNumber, "" );
   lstrcpy(rdParams.szUserName,    String_val ( userName ) );
   lstrcpy(rdParams.szPassword,    String_val ( password ) );
   lstrcpy(rdParams.szDomain,      String_val ( domain ) );
   
   cb_info.g_status = 0;
   cb_info.mt = mt;
   cb_info.p_closure = &callback;
   cb_info.entryName = entryName;
   
   textout ( mtINFO, "Dialing %s", entryName );
   if (debug_print)
      printf ( "I am inside c_win32_dial!\n" );

   if ( mt )
      enter_blocking_section ();
   
   dwRet = RasDial ( NULL, NULL, &rdParams, 1L,
	     (RASDIALFUNC) RasDialFunc1, &hRasConn );

   if ( mt )
      leave_blocking_section ();
   
   if ( dwRet )
   {
      char		szBuf[256];
      
      if ( RasGetErrorString( dwRet, szBuf, 256 ) != 0 )
	 wsprintf( (LPSTR)szBuf, "Undefined RAS Dial Error (%ld).",
		   dwRet );
      textout ( mtERR, "Error attempting to connect: %s", szBuf );
      hangup ( hRasConn );
   }

   CAMLreturn (Val_bool ( 1 ));
   return 0; /* dummy, to shut down warning */
}
开发者ID:kign,项目名称:inet-lab,代码行数:62,代码来源:ocamlras.c

示例13: lwt_unix_mapped

CAMLprim value lwt_unix_mapped(value v_bstr) {
  return Val_bool(Caml_ba_array_val(v_bstr)->flags & CAML_BA_MAPPED_FILE);
}
开发者ID:copy,项目名称:lwt,代码行数:3,代码来源:lwt_unix_stubs.c

示例14: ml_elm_fileselector_button_inwin_mode_get

PREFIX value ml_elm_fileselector_button_inwin_mode_get(value v_obj)
{
        return Val_bool(elm_fileselector_button_inwin_mode_get(
                Evas_Object_val(v_obj)));
}
开发者ID:axiles,项目名称:ocaml-efl,代码行数:5,代码来源:elm_fileselector_button_wrap.c

示例15: ml_elm_fileselector_multi_select_get

PREFIX value ml_elm_fileselector_multi_select_get(value v_obj)
{
        return Val_bool(elm_fileselector_multi_select_get(
                (Evas_Object*) v_obj));
}
开发者ID:PawelMarc,项目名称:ocaml-efl,代码行数:5,代码来源:elm_fileselector_wrap.c


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