• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ c_strlen函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: gprs_readTimeStamp

static int gprs_readTimeStamp( lua_State* L )
{
int timeout = luaL_checkinteger(L, 1)*1000000;
uint8_t result = 3;
char *ret;

	if( gprs_StartSocket(L) == 1 )
	{
		result = 4;
		if( gprs_SendSocket(L,"GET") == 1 )
		{
			//if( (ret = readCommand(NULL,"}\r\n","}\r\n","{\"time\":","}\r\n",L)) != NULL )
			if( (ret = readCommand(NULL,"}\r\n","}\r\n","{","}\r\n",L)) != NULL )
			{
				char saida[512];
				memset(saida,0,512);
				c_memcpy(saida,ret,c_strlen(ret));
				sendCommand((char*)CIPCLOSE, MSG_OK, MSG_NOK, strlen(CIPCLOSE), timeout/10);
				//lua_pushlstring(L,tm, 10);
				lua_pushlstring(L,saida, c_strlen(saida));
				lua_pushinteger(L,0);
				return 2;
			}else
				result = 5;
		}
	}
	lua_pushinteger(L,result);
	return 1;
}
开发者ID:bastos1505,项目名称:nodemcu-firmware,代码行数:29,代码来源:gprs.c


示例2: fx_Error_toString

void fx_Error_toString(txMachine* the)
{
	txInteger aLength;
	
	mxPushSlot(mxThis);
	fxGetID(the, mxID(_name));
	if (the->stack->kind == XS_UNDEFINED_KIND) 
		fxCopyStringC(the, the->stack, "Error");
	else	
		fxToString(the, the->stack);
	mxPushSlot(mxThis);
	fxGetID(the, mxID(_message));
	if (the->stack->kind == XS_UNDEFINED_KIND) 
		fxCopyStringC(the, the->stack, "");
	else	
		fxToString(the, the->stack);
	aLength = c_strlen(the->stack->value.string);
	if (aLength) {
		aLength += c_strlen((the->stack + 1)->value.string) + 2;
		mxResult->value.string = (txString)fxNewChunk(the, aLength + 1);
		mxResult->kind = XS_STRING_KIND;
		c_strcpy(mxResult->value.string, (the->stack + 1)->value.string);
		c_strcat(mxResult->value.string, ": ");
		c_strcat(mxResult->value.string, the->stack->value.string);
		the->stack++;
		the->stack++;
	}
	else {
		the->stack++;
		mxPullSlot(mxResult);
	}
}
开发者ID:afrog33k,项目名称:kinomajs,代码行数:32,代码来源:xs6Error.c


示例3: c_malloc

char            *c_getnextline(const int fd, char c)
{
  int		 i;
  char		buff;
  char		*ptr;

  ptr = c_malloc(sizeof(char) * 1);
  ptr[0] = '\0';
  i = 0;
  if (read(fd, &buff, 1) != 1)
    return (NULL);
  if (buff <= 31 || buff > 176)
    c_puterror("fichier corrompu");
  ptr = c_realloc(ptr, sizeof(char) * (c_strlen(ptr, '\0') + 2));
  ptr[i++] = buff;
  ptr[i] = '\0';
  while (read(fd, &buff, 1) == 1 && buff != '\n' && buff != c)
    {
      if (buff <= 31 || buff > 176)
	c_puterror("fichier corrompu");
      ptr = realloc(ptr, sizeof(char) * (c_strlen(ptr, '\0') + 2));
      ptr[i++] = buff;
      ptr[i] = '\0';
    }
  return (ptr);
}
开发者ID:ChevalCorp,项目名称:RayTracer,代码行数:26,代码来源:c_getnextline.c


示例4: addlenmod

/*
** add length modifier into formats
*/
static void addlenmod (char *form, const char *lenmod) {
  size_t l = c_strlen(form);
  size_t lm = c_strlen(lenmod);
  char spec = form[l - 1];
  c_strcpy(form + l - 1, lenmod);
  form[l + lm - 1] = spec;
  form[l + lm] = '\0';
}
开发者ID:141141,项目名称:nodemcu-firmware-lua5.3.0,代码行数:11,代码来源:lstrlib.c


示例5: fxBufferFunctionName

void fxBufferFunctionName(txMachine* the, txString buffer, txSize size, txSlot* function, txString suffix)
{
	txSlot* slot = fxGetProperty(the, function, mxID(_name));
	if (slot && ((slot->kind == XS_STRING_KIND) || (slot->kind == XS_STRING_X_KIND))) {
		c_strncat(buffer, slot->value.string, size - c_strlen(buffer) - 1);
		c_strncat(buffer, suffix, size - c_strlen(buffer) - 1);
	}
}
开发者ID:dadongdong,项目名称:kinomajs,代码行数:8,代码来源:xs6All.c


示例6: fxBufferObjectName

void fxBufferObjectName(txMachine* the, txString buffer, txSize size, txSlot* object, txString suffix)
{
	txSlot* slot = fxGetProperty(the, object, mxID(_Symbol_toStringTag));
	if (slot && ((slot->kind == XS_STRING_KIND) || (slot->kind == XS_STRING_X_KIND))) {
		c_strncat(buffer, slot->value.string, size - c_strlen(buffer) - 1);
		c_strncat(buffer, suffix, size - c_strlen(buffer) - 1);
	}
}
开发者ID:dadongdong,项目名称:kinomajs,代码行数:8,代码来源:xs6All.c


示例7: wifi_scan_done

/**
  * @brief  Wifi ap scan over callback to display.
  * @param  arg: contain the aps information
  * @param  status: scan over status
  * @retval None
  */
static void wifi_scan_done(void *arg, STATUS status)
{
  uint8 ssid[33];
  char temp[128];
  if(wifi_scan_succeed == LUA_NOREF)
    return;
  if(arg == NULL)
    return;
  
  lua_rawgeti(gL, LUA_REGISTRYINDEX, wifi_scan_succeed);

  if (status == OK)
  {
    struct bss_info *bss_link = (struct bss_info *)arg;
    bss_link = bss_link->next.stqe_next;//ignore first
    lua_newtable( gL );

    while (bss_link != NULL)
    {
      c_memset(ssid, 0, 33);
      if (c_strlen(bss_link->ssid) <= 32)
      {
        c_memcpy(ssid, bss_link->ssid, c_strlen(bss_link->ssid));
      }
      else
      {
        c_memcpy(ssid, bss_link->ssid, 32);
      }
      if(getap_output_format==1) //use new format(BSSID : SSID, RSSI, Authmode, Channel)
      {
    	c_sprintf(temp,"%s,%d,%d,%d", ssid, bss_link->rssi, bss_link->authmode, bss_link->channel);
    	lua_pushstring(gL, temp);
        NODE_DBG(MACSTR" : %s\n",MAC2STR(bss_link->bssid) , temp);
    	c_sprintf(temp,MACSTR, MAC2STR(bss_link->bssid));
    	lua_setfield( gL, -2,  temp);
      }
      else//use old format(SSID : Authmode, RSSI, BSSID, Channel)
      {
  	    c_sprintf(temp,"%d,%d,"MACSTR",%d", bss_link->authmode, bss_link->rssi, MAC2STR(bss_link->bssid),bss_link->channel);
        lua_pushstring(gL, temp);
        lua_setfield( gL, -2, ssid );
        NODE_DBG("%s : %s\n", ssid, temp);
      }

      bss_link = bss_link->next.stqe_next;
    }
  }
  else
  {
    lua_newtable( gL );
  }
  lua_call(gL, 1, 0);
  if(wifi_scan_succeed != LUA_NOREF)
  {
    luaL_unref(gL, LUA_REGISTRYINDEX, wifi_scan_succeed);
    wifi_scan_succeed = LUA_NOREF;
  }
}
开发者ID:tjclement,项目名称:nodemcu-firmware,代码行数:64,代码来源:wifi.c


示例8: node_compile

// Lua: compile(filename) -- compile lua file into lua bytecode, and save to .lc
static int node_compile( lua_State* L )
{
  Proto* f;
  int file_fd = FS_OPEN_OK - 1;
  size_t len;
  const char *fname = luaL_checklstring( L, 1, &len );
  if ( len > FS_NAME_MAX_LENGTH )
    return luaL_error(L, "filename too long");

  char output[FS_NAME_MAX_LENGTH];
  c_strcpy(output, fname);
  // check here that filename end with ".lua".
  if (len < 4 || (c_strcmp( output + len - 4, ".lua") != 0) )
    return luaL_error(L, "not a .lua file");

  output[c_strlen(output) - 2] = 'c';
  output[c_strlen(output) - 1] = '\0';
  NODE_DBG(output);
  NODE_DBG("\n");
  if (luaL_loadfsfile(L, fname) != 0) {
    return luaL_error(L, lua_tostring(L, -1));
  }

  f = toproto(L, -1);

  int stripping = 1;      /* strip debug information? */

  file_fd = fs_open(output, fs_mode2flag("w+"));
  if (file_fd < FS_OPEN_OK)
  {
    return luaL_error(L, "cannot open/write to file");
  }

  lua_lock(L);
  int result = luaU_dump(L, f, writer, &file_fd, stripping);
  lua_unlock(L);

  if (fs_flush(file_fd) < 0) {   // result codes aren't propagated by flash_fs.h
    // overwrite Lua error, like writer() does in case of a file io error
    result = 1;
  }
  fs_close(file_fd);
  file_fd = FS_OPEN_OK - 1;

  if (result == LUA_ERR_CC_INTOVERFLOW) {
    return luaL_error(L, "value too big or small for target integer type");
  }
  if (result == LUA_ERR_CC_NOTINTEGER) {
    return luaL_error(L, "target lua_Number is integral but fractional value found");
  }
  if (result == 1) {    // result status generated by writer() or fs_flush() fail
    return luaL_error(L, "writing to file failed");
  }

  return 0;
}
开发者ID:Alvaro99CL,项目名称:nodemcu-firmware,代码行数:57,代码来源:node.c


示例9: handle_get_variable

static int handle_get_variable(const coap_endpoint_t *ep, coap_rw_buffer_t *scratch, const coap_packet_t *inpkt, coap_packet_t *outpkt, uint8_t id_hi, uint8_t id_lo)
{
    const coap_option_t *opt;
    uint8_t count;
    int n;
    if (NULL != (opt = coap_findOptions(inpkt, COAP_OPTION_URI_PATH, &count)))
    {
        if ((count != ep->path->count ) && (count != ep->path->count + 1)) // +1 for /f/[function], /v/[variable]
        {
            NODE_DBG("should never happen.\n");
            goto end;
        }
        if (count == ep->path->count + 1)
        {
            coap_luser_entry *h = ep->user_entry->next;     // ->next: skip the first entry(head)
            while(NULL != h){
                if (opt[count-1].buf.len != c_strlen(h->name))
                {
                    h = h->next;
                    continue;
                }
                if (0 == c_memcmp(h->name, opt[count-1].buf.p, opt[count-1].buf.len))
                {
                    NODE_DBG("/v1/v/");
                    NODE_DBG_((char *)h->name);
                    NODE_DBG(" match.\n");
                    if(h->L == NULL)
                        return coap_make_response(scratch, outpkt, NULL, 0, id_hi, id_lo, &inpkt->tok, COAP_RSPCODE_NOT_FOUND, COAP_CONTENTTYPE_NONE);
                    if(c_strlen(h->name))
                    {
                        n = lua_gettop(h->L);
                        lua_getglobal(h->L, h->name);
                        if (!lua_isnumber(h->L, -1)) {
                            NODE_DBG ("should be a number.\n");
                            lua_settop(h->L, n);
                            return coap_make_response(scratch, outpkt, NULL, 0, id_hi, id_lo, &inpkt->tok, COAP_RSPCODE_NOT_FOUND, COAP_CONTENTTYPE_NONE);
                        } else {
                            const char *res = lua_tostring(h->L,-1);
                            lua_settop(h->L, n);
                            return coap_make_response(scratch, outpkt, (const uint8_t *)res, c_strlen(res), id_hi, id_lo, &inpkt->tok, COAP_RSPCODE_CONTENT, COAP_CONTENTTYPE_TEXT_PLAIN);
                        }
                    }
                } else {
                    h = h->next;
                }
            }
        }else{
            NODE_DBG("/v1/v match.\n");
            goto end;
        }
    }
    NODE_DBG("none match.\n");
end:
    return coap_make_response(scratch, outpkt, NULL, 0, id_hi, id_lo, &inpkt->tok, COAP_RSPCODE_CONTENT, COAP_CONTENTTYPE_TEXT_PLAIN);
}
开发者ID:pvvx,项目名称:EspLua,代码行数:55,代码来源:endpoints.c


示例10: fxConcatString

txString fxConcatString(txMachine* the, txSlot* a, txSlot* b)
{
	txSize aSize = c_strlen(a->value.string);
	txSize bSize = c_strlen(b->value.string);
	txString result = (txString)fxNewChunk(the, aSize + bSize + 1);
	c_memcpy(result, a->value.string, aSize);
	c_memcpy(result + aSize, b->value.string, bSize + 1);
	a->value.string = result;
	a->kind = XS_STRING_KIND;
	return result;
}
开发者ID:dadongdong,项目名称:kinomajs,代码行数:11,代码来源:xs6All.c


示例11: vfs_chdir

sint32_t vfs_chdir( const char *path )
{
    vfs_fs_fns *fs_fns;
    const char *normpath = normalize_path( path );
    const char *level;
    char *outname;
    int ok = VFS_RES_ERR;

#if LDRV_TRAVERSAL
    // track dir level
    if (normpath[0] == '/') {
        dir_level = 0;
        level = &(normpath[1]);
    } else {
        level = normpath;
    }
    while (c_strlen( level ) > 0) {
        dir_level++;
        if (level = c_strchr( level, '/' )) {
            level++;
        } else {
            break;
        }
    }
#endif

#ifdef BUILD_SPIFFS
    if (fs_fns = myspiffs_realm( normpath, &outname, TRUE )) {
        // our SPIFFS integration doesn't support directories
        if (c_strlen( outname ) == 0) {
            ok = VFS_RES_OK;
        }
    }
#endif

#ifdef BUILD_FATFS
    if (fs_fns = myfatfs_realm( normpath, &outname, TRUE )) {
        if (c_strchr( outname, ':' )) {
            // need to set FatFS' default drive
            fs_fns->chdrive( outname );
            // and force chdir to root in case path points only to root
            fs_fns->chdir( "/" );
        }
        if (fs_fns->chdir( outname ) == VFS_RES_OK) {
            ok = VFS_RES_OK;
        }
        c_free( outname );
    }
#endif

    return ok == VFS_RES_OK ? VFS_RES_OK : VFS_RES_ERR;
}
开发者ID:karrots,项目名称:nodemcu-firmware,代码行数:52,代码来源:vfs.c


示例12: fxLoadLibrary

txModuleData* fxLoadLibrary(txMachine* the, txString path, txScript* script)
{
	txModuleData* data = C_NULL;
	if (script) {
		if (script->version[3] == 1) {
			char buffer[PATH_MAX];
			char* dot;
			void* library;
			txCallback callback;
			c_strcpy(buffer, path);
			dot = c_strrchr(buffer, '.');
			if (dot)
				*dot = 0;
			#if mxWindows
				c_strcat(buffer, ".dll");
				#if mxReport
					fxReport(the, "# Loading library \"%s\"\n", buffer);
				#endif
				library = LoadLibrary(buffer);
				mxElseError(library);
				callback = (txCallback)GetProcAddress(library, "xsHostModule");
				mxElseError(callback);
			#else
				c_strcat(buffer, ".so");
				#if mxReport
					fxReport(the, "# Loading library \"%s\"\n", buffer);
				#endif
				library = dlopen(buffer, RTLD_NOW);
				mxElseError(library);
				callback = (txCallback)dlsym(library, "xsHostModule");
				mxElseError(callback);
			#endif
			data = c_malloc(sizeof(txModuleData) + c_strlen(buffer));
			mxElseError(data);
			data->library = library;
			data->the = the;
			c_strcpy(data->path, buffer);
			script->callback = callback;
			return data;
		}
	}
#if mxReport
	data = c_malloc(sizeof(txModuleData) + c_strlen(path));
	mxElseError(data);
	data->library = C_NULL;
	data->the = the;
	c_strcpy(data->path, path);
	fxReport(the, "# Loading module \"%s\"\n", path);
#endif
	return data;
}
开发者ID:kouis3940,项目名称:kinomajs,代码行数:51,代码来源:xs6Host.c


示例13: fxThrowMessage

void fxThrowMessage(txMachine* the, txString path, txInteger line, txError error, txString format, ...)
{
	char message[128] = "";
	txInteger length = 0;
    va_list arguments;
    txSlot* slot;
	fxBufferFrameName(the, message, sizeof(message), the->frame, ": ");
	length = c_strlen(message);
    va_start(arguments, format);
    vsnprintf(message + length, sizeof(message) - length, format, arguments);
    va_end(arguments);
	if ((error <= XS_NO_ERROR) || (XS_ERROR_COUNT <= error))
		error = XS_UNKNOWN_ERROR;
    
    slot = fxNewSlot(the);
    slot->kind = XS_INSTANCE_KIND;
    slot->value.instance.garbage = C_NULL;
    slot->value.instance.prototype = mxErrorPrototypes(error).value.reference;
	mxException.kind = XS_REFERENCE_KIND;
	mxException.value.reference = slot;
	slot = fxNextStringProperty(the, slot, message, mxID(_message), XS_DONT_ENUM_FLAG);
#ifdef mxDebug
	fxDebugThrow(the, path, line, message);
#endif
	fxJump(the);
}
开发者ID:dadongdong,项目名称:kinomajs,代码行数:26,代码来源:xs6API.c


示例14: lua_pushvalue

LUALIB_API const char *luaL_findtable (lua_State *L, int idx,
                                       const char *fname, int szhint) {
  const char *e;
  lua_pushvalue(L, idx);
  do {
    e = c_strchr(fname, '.');
    if (e == NULL) e = fname + c_strlen(fname);
    lua_pushlstring(L, fname, e - fname);
    lua_rawget(L, -2);
    if (lua_isnil(L, -1)) {
      /* If looking for a global variable, check the rotables too */
      void *ptable = luaR_findglobal(fname, e - fname);
      if (ptable) {
        lua_pop(L, 1);
        lua_pushrotable(L, ptable);
      }
    }
    if (lua_isnil(L, -1)) {  /* no such field? */
      lua_pop(L, 1);  /* remove this nil */
      lua_createtable(L, 0, (*e == '.' ? 1 : szhint)); /* new table for field */
      lua_pushlstring(L, fname, e - fname);
      lua_pushvalue(L, -2);
      lua_settable(L, -4);  /* set new table into field */
    }
    else if (!lua_istable(L, -1) && !lua_isrotable(L, -1)) {  /* field has a non-table value? */
      lua_pop(L, 2);  /* remove table and value */
      return fname;  /* return problematic part of the name */
    }
    lua_remove(L, -2);  /* remove previous table */
    fname = e + 1;
  } while (*e == '.');
  return NULL;
}
开发者ID:Alvaro99CL,项目名称:nodemcu-firmware,代码行数:33,代码来源:lauxlib.c


示例15: cipher_process

static void
cipher_process(xsMachine *the, kcl_symmetric_direction_t direction)
{
	crypt_cipher_t *cipher = xsGetHostData(xsThis);
	size_t len;
	void *indata, *outdata;

	if (cipher->keysched != NULL) {
		if (cipher->direction != direction) {
			(*cipher->keysched)(cipher->ctx, direction);
			cipher->direction = direction;
		}
	}
	if (xsToInteger(xsArgc) > 1 && xsTest(xsArg(1))) {
		if (xsGetArrayBufferLength(xsArg(1)) < (xsIntegerValue)cipher->blockSize)
			crypt_throw_error(the, "cipher: too small buffer");
		xsResult = xsArg(1);
	}
	else
		xsResult = xsArrayBuffer(NULL, cipher->blockSize);
	if (xsTypeOf(xsArg(0)) == xsStringType) {
		indata = xsToString(xsArg(0));
		len = c_strlen(indata);
	}
	else {
		indata = xsToArrayBuffer(xsArg(0));
		len = xsGetArrayBufferLength(xsArg(0));
	}
	if (len < cipher->blockSize)
		crypt_throw_error(the, "cipher: wrong size");
	outdata = xsToArrayBuffer(xsResult);
	(*cipher->process)(cipher->ctx, indata, outdata);
}
开发者ID:basuke,项目名称:kinomajs,代码行数:33,代码来源:crypt_cipher.c


示例16: fxLoadModuleXML

void fxLoadModuleXML(txMachine* the, txString path, txID moduleID)
{
	FskFileMapping map = NULL;
	txFileMapStream fileMapStream;
	txStringStream stringStream;
	txScript* script = NULL;
	
	mxTry(the) {
		fxBeginHost(the);
		xsThrowIfFskErr(FskFileMap(path, &fileMapStream.buffer, &fileMapStream.size, 0, &map));
		fileMapStream.offset = 0;
		mxPushInteger(0);
		mxPushInteger(0);
		mxPushInteger(0);
		mxPushInteger(0);
		mxPushInteger(3);
		fxParse(the, &fileMapStream, fxFileMapGetter, path, 1, xsSourceFlag | xsDebugFlag);
		fxCallID(the, fxID(the, "generate"));
		fxToString(the, the->stack);
		stringStream.slot = the->stack;
		stringStream.size = c_strlen(stringStream.slot->value.string);
		stringStream.offset = 0;
		script = fxParseScript(the, &stringStream, fxStringGetter, mxDebugFlag);
		fxEndHost(the);
	}
	mxCatch(the) {
		break;
	}
	FskFileDisposeMap(map);
	fxResolveModule(the, moduleID, script, NULL, NULL);
}
开发者ID:dadongdong,项目名称:kinomajs,代码行数:31,代码来源:xs6Host.c


示例17: xs_stream_encrypt

void
xs_stream_encrypt(xsMachine *the)
{
	crypt_stream_t *stream = xsGetHostData(xsThis);
	int ac = xsToInteger(xsArgc);
	size_t len;
	void *indata, *outdata;

	if (xsTypeOf(xsArg(0)) == xsStringType)
		len = c_strlen(xsToString(xsArg(0)));
	else
		len = xsGetArrayBufferLength(xsArg(0));
	if (ac > 2 && xsTypeOf(xsArg(2)) != xsUndefinedType) {
		size_t n = xsToInteger(xsArg(2));
		if (n < len)
			len = n;
	}
	if (ac > 1 && xsTest(xsArg(1))) {
		if (xsGetArrayBufferLength(xsArg(1)) < (xsIntegerValue)len)
			crypt_throw_error(the, "too small buffer");
		xsResult = xsArg(1);
	}
	else
		xsResult = xsArrayBuffer(NULL, len);
	if (xsTypeOf(xsArg(0)) == xsStringType)
		indata = xsToString(xsArg(0));
	else
		indata = xsToArrayBuffer(xsArg(0));
	outdata = xsToArrayBuffer(xsResult);
	(*stream->process)(stream->ctx, indata, outdata, len);
}
开发者ID:basuke,项目名称:kinomajs,代码行数:31,代码来源:crypt_stream.c


示例18: luaO_chunkid

void luaO_chunkid (char *out, const char *source, size_t bufflen) {
  if (*source == '=') {
    c_strncpy(out, source+1, bufflen);  /* remove first char */
    out[bufflen-1] = '\0';  /* ensures null termination */
  }
  else {  /* out = "source", or "...source" */
    if (*source == '@') {
      size_t l;
      source++;  /* skip the `@' */
      bufflen -= sizeof(" '...' ");
      l = c_strlen(source);
      c_strcpy(out, "");
      if (l > bufflen) {
        source += (l-bufflen);  /* get last part of file name */
        c_strcat(out, "...");
      }
      c_strcat(out, source);
    }
    else {  /* out = [string "string"] */
      size_t len = c_strcspn(source, "\n\r");  /* stop at first newline */
      bufflen -= sizeof(" [string \"...\"] ");
      if (len > bufflen) len = bufflen;
      c_strcpy(out, "[string \"");
      if (source[len] != '\0') {  /* must truncate? */
        c_strncat(out, source, len);
        c_strcat(out, "...");
      }
      else
        c_strcat(out, source);
      c_strcat(out, "\"]");
    }
  }
}
开发者ID:3dot3,项目名称:nodemcu-firmware,代码行数:33,代码来源:lobject.c


示例19: addintlen

static void addintlen (char *form) {
  size_t l = c_strlen(form);
  char spec = form[l - 1];
  c_strcpy(form + l - 1, LUA_INTFRMLEN);
  form[l + sizeof(LUA_INTFRMLEN) - 2] = spec;
  form[l + sizeof(LUA_INTFRMLEN) - 1] = '\0';
}
开发者ID:AbuShaqra,项目名称:nodemcu-firmware,代码行数:7,代码来源:lstrlib.c


示例20: fx_JSON_parse

void fx_JSON_parse(txMachine* the)
{
	txSlot* aSlot;
	txStringCStream aCStream;
	txStringStream aStream;

	aSlot = fxGetInstance(the, mxThis);
	if (aSlot->flag & XS_SANDBOX_FLAG)
		the->frame->flag |= XS_SANDBOX_FLAG;
	else
		the->frame->flag |= the->frame->next->flag & XS_SANDBOX_FLAG;
	if (mxArgc < 1)
		mxDebug0(the, XS_SYNTAX_ERROR, "JSON.parse: no buffer");
	aSlot = fxGetInstance(the, mxArgv(0));
	if (mxIsChunk(aSlot)) {
		aSlot = aSlot->next;
		aCStream.buffer = aSlot->value.host.data;
		aCStream.size = aSlot->next->value.integer;
		aCStream.offset = 0;
		fxParseJSON(the, &aCStream, fxStringCGetter);
	}
	else {
		fxToString(the, mxArgv(0));
		aStream.slot = mxArgv(0);
		aStream.size = c_strlen(aStream.slot->value.string);
		aStream.offset = 0;
		fxParseJSON(the, &aStream, fxStringGetter);
	}
	*mxResult = *(the->stack++);
}
开发者ID:dadongdong,项目名称:kinomajs,代码行数:30,代码来源:xsJSON.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ca_assert函数代码示例发布时间:2022-05-30
下一篇:
C++ c_strdup函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap