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

C++ LFUNCVAL函数代码示例

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

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



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

示例1: do_sleep_opt

  do_sleep_opt (L, 2);
  rtctime_deep_sleep_us (us); // does not return
  return 0;
}


// rtctime.dsleep_aligned (aligned_usec, min_usec, option)
static int rtctime_dsleep_aligned (lua_State *L)
{
  if (!rtctime_have_time ())
    return luaL_error (L, "time not available, unable to align");

  uint32_t align_us = luaL_checknumber (L, 1);
  uint32_t min_us = luaL_checknumber (L, 2);
  do_sleep_opt (L, 3);
  rtctime_deep_sleep_until_aligned_us (align_us, min_us); // does not return
  return 0;
}


// Module function map
static const LUA_REG_TYPE rtctime_map[] = {
  { LSTRKEY("set"),            LFUNCVAL(rtctime_set) },
  { LSTRKEY("get"),            LFUNCVAL(rtctime_get) },
  { LSTRKEY("dsleep"),         LFUNCVAL(rtctime_dsleep)  },
  { LSTRKEY("dsleep_aligned"), LFUNCVAL(rtctime_dsleep_aligned) },
  { LNILKEY, LNILVAL }
};

NODEMCU_MODULE(RTCTIME, "rtctime", rtctime_map, NULL);
开发者ID:Alvaro99CL,项目名称:nodemcu-firmware,代码行数:30,代码来源:rtctime.c


示例2: os_update_cpu_frequency

    os_update_cpu_frequency(CPU160MHZ);
  } else {
    REG_CLR_BIT(0x3ff00014,  BIT(0));
    os_update_cpu_frequency(CPU80MHZ);
  }
  new_freq = ets_get_cpu_frequency();
  lua_pushinteger(L, new_freq);
  return 1;
}

// Module function map
#define MIN_OPT_LEVEL 2
#include "lrodefs.h"
const LUA_REG_TYPE node_map[] =
{
  { LSTRKEY( "restart" ), LFUNCVAL( node_restart ) },
  { LSTRKEY( "dsleep" ), LFUNCVAL( node_deepsleep ) },
  { LSTRKEY( "info" ), LFUNCVAL( node_info ) },
  { LSTRKEY( "chipid" ), LFUNCVAL( node_chipid ) },
  { LSTRKEY( "flashid" ), LFUNCVAL( node_flashid ) },
  { LSTRKEY( "flashsize" ), LFUNCVAL( node_flashsize) },
  { LSTRKEY( "heap" ), LFUNCVAL( node_heap ) },
#ifdef DEVKIT_VERSION_0_9
  { LSTRKEY( "key" ), LFUNCVAL( node_key ) },
  { LSTRKEY( "led" ), LFUNCVAL( node_led ) },
#endif
  { LSTRKEY( "input" ), LFUNCVAL( node_input ) },
  { LSTRKEY( "output" ), LFUNCVAL( node_output ) },
// Moved to adc module, use adc.readvdd33()  
// { LSTRKEY( "readvdd33" ), LFUNCVAL( node_readvdd33) },
  { LSTRKEY( "compile" ), LFUNCVAL( node_compile) },
开发者ID:AmenophisIII,项目名称:nodemcu-firmware,代码行数:31,代码来源:node.c


示例3: luaL_error

  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");
  }

  return 0;
}

#define MIN_OPT_LEVEL   2
#include "lrodefs.h"
const LUA_REG_TYPE file_map[] =
{
  { LSTRKEY( "list" ), LFUNCVAL( file_list ) },
  { LSTRKEY( "slist" ), LFUNCVAL( file_slist ) },
  { LSTRKEY( "format" ), LFUNCVAL( file_format ) },
  { LSTRKEY( "open" ), LFUNCVAL( file_open ) },
  { LSTRKEY( "close" ), LFUNCVAL( file_close ) },
  { LSTRKEY( "write" ), LFUNCVAL( file_write ) },
  { LSTRKEY( "writeline" ), LFUNCVAL( file_writeline ) },
  { LSTRKEY( "read" ), LFUNCVAL( file_read ) },
  { LSTRKEY( "readline" ), LFUNCVAL( file_readline ) },
  { LSTRKEY( "remove" ), LFUNCVAL( file_remove ) },
  { LSTRKEY( "seek" ), LFUNCVAL( file_seek ) },
  { LSTRKEY( "flush" ), LFUNCVAL( file_flush ) },
  { LSTRKEY( "rename" ), LFUNCVAL( file_rename ) },
  { LSTRKEY( "info" ), LFUNCVAL( file_info ) },
  { LSTRKEY( "state" ), LFUNCVAL( file_state ) },
  { LSTRKEY( "compile" ), LFUNCVAL( file_compile ) },
开发者ID:fritsjek,项目名称:MICO-1,代码行数:30,代码来源:file.c


示例4: lua_tointeger

  int crc = 0;
  if(lua_isnumber(L, 2))
    crc = lua_tointeger(L, 2);
  if(crc > 65535)
    return luaL_error( L, "wrong arg range" );

  lua_pushinteger( L, onewire_crc16(pdata, (uint16_t)datalen, (uint16_t)crc) );

  return 1;
}
#endif
#endif

// Module function map
static const LUA_REG_TYPE ow_map[] = {
  { LSTRKEY( "setup" ),         LFUNCVAL( ow_setup ) },
  { LSTRKEY( "reset" ),         LFUNCVAL( ow_reset ) },
  { LSTRKEY( "skip" ),          LFUNCVAL( ow_skip ) },
  { LSTRKEY( "select" ),        LFUNCVAL( ow_select ) },
  { LSTRKEY( "write" ),         LFUNCVAL( ow_write ) },
  { LSTRKEY( "write_bytes" ),   LFUNCVAL( ow_write_bytes ) },
  { LSTRKEY( "read" ),          LFUNCVAL( ow_read ) },
  { LSTRKEY( "read_bytes" ),    LFUNCVAL( ow_read_bytes ) },
  { LSTRKEY( "depower" ),       LFUNCVAL( ow_depower ) },
#if ONEWIRE_SEARCH
  { LSTRKEY( "reset_search" ),  LFUNCVAL( ow_reset_search ) },
  { LSTRKEY( "target_search" ), LFUNCVAL( ow_target_search ) },
  { LSTRKEY( "search" ),        LFUNCVAL( ow_search ) },
#endif
#if ONEWIRE_CRC
  { LSTRKEY( "crc8" ),          LFUNCVAL( ow_crc8 ) },
开发者ID:Dxploto,项目名称:nodemcu-firmware,代码行数:31,代码来源:ow.c


示例5: luaL_error

        default: {  /* also treat cases `pnLlh' */
          return luaL_error(L, "invalid option " LUA_QL("%%%c") " to "
                               LUA_QL("format"), *(strfrmt - 1));
        }
      }
      luaL_addlstring(&b, buff, c_strlen(buff));
    }
  }
  luaL_pushresult(&b);
  return 1;
}

#define MIN_OPT_LEVEL 1
#include "lrodefs.h"
const LUA_REG_TYPE strlib[] = {
  {LSTRKEY("byte"), LFUNCVAL(str_byte)},
  {LSTRKEY("char"), LFUNCVAL(str_char)},
  {LSTRKEY("dump"), LFUNCVAL(str_dump)},
  {LSTRKEY("find"), LFUNCVAL(str_find)},
  {LSTRKEY("format"), LFUNCVAL(str_format)},
#if LUA_OPTIMIZE_MEMORY > 0 && defined(LUA_COMPAT_GFIND)
  {LSTRKEY("gfind"), LFUNCVAL(gmatch)},
#else
  {LSTRKEY("gfind"), LFUNCVAL(gfind_nodef)},
#endif
  {LSTRKEY("gmatch"), LFUNCVAL(gmatch)},
  {LSTRKEY("gsub"), LFUNCVAL(str_gsub)},
  {LSTRKEY("len"), LFUNCVAL(str_len)},
  {LSTRKEY("lower"), LFUNCVAL(str_lower)},
  {LSTRKEY("match"), LFUNCVAL(str_match)},
  {LSTRKEY("rep"), LFUNCVAL(str_rep)},
开发者ID:AbuShaqra,项目名称:nodemcu-firmware,代码行数:31,代码来源:lstrlib.c


示例6: version

}


// Lua: elua.version()
static int version( lua_State *L )
{
  lua_pushstring( L, ELUA_STR_VERSION );
  return 1;
}

// Module function map
#define MIN_OPT_LEVEL 2
#include "lrodefs.h"
const LUA_REG_TYPE elua_map[] = 
{
  { LSTRKEY( "egc_setup" ), LFUNCVAL( egc_setup ) },
  { LSTRKEY( "version" ), LFUNCVAL( version ) },
#if LUA_OPTIMIZE_MEMORY > 0
  { LSTRKEY( "EGC_NOT_ACTIVE" ), LNUMVAL( EGC_NOT_ACTIVE ) },
  { LSTRKEY( "EGC_ON_ALLOC_FAILURE" ), LNUMVAL( EGC_ON_ALLOC_FAILURE ) },
  { LSTRKEY( "EGC_ON_MEM_LIMIT" ), LNUMVAL( EGC_ON_MEM_LIMIT ) },
  { LSTRKEY( "EGC_ALWAYS" ), LNUMVAL( EGC_ALWAYS ) },
#endif
  { LNILKEY, LNILVAL }
};

LUALIB_API int luaopen_elua( lua_State *L )
{
#if LUA_OPTIMIZE_MEMORY > 0
  return 0;
#else
开发者ID:BackupTheBerlios,项目名称:elua-svn,代码行数:31,代码来源:elua.c


示例7: wifi_ap_dhcp_stop

  return 1;
}

// Lua: wifi.ap.dhcp.stop()
static int wifi_ap_dhcp_stop( lua_State* L )
{
  lua_pushboolean(L, wifi_softap_dhcps_stop());
  return 1;
}

// Module function map
#define MIN_OPT_LEVEL 2
#include "lrodefs.h"
static const LUA_REG_TYPE wifi_station_map[] =
{
  { LSTRKEY( "getconfig" ), LFUNCVAL ( wifi_station_getconfig ) },
  { LSTRKEY( "config" ), LFUNCVAL ( wifi_station_config ) },
  { LSTRKEY( "connect" ), LFUNCVAL ( wifi_station_connect4lua ) },
  { LSTRKEY( "disconnect" ), LFUNCVAL ( wifi_station_disconnect4lua ) },
  { LSTRKEY( "autoconnect" ), LFUNCVAL ( wifi_station_setauto ) },
  { LSTRKEY( "getip" ), LFUNCVAL ( wifi_station_getip ) },
  { LSTRKEY( "setip" ), LFUNCVAL ( wifi_station_setip ) },
  { LSTRKEY( "getbroadcast" ), LFUNCVAL ( wifi_station_getbroadcast) },
  { LSTRKEY( "getmac" ), LFUNCVAL ( wifi_station_getmac ) },
  { LSTRKEY( "setmac" ), LFUNCVAL ( wifi_station_setmac ) },
  { LSTRKEY( "getap" ), LFUNCVAL ( wifi_station_listap ) },
  { LSTRKEY( "status" ), LFUNCVAL ( wifi_station_status ) },
  { LSTRKEY( "eventMonReg" ), LFUNCVAL ( wifi_station_event_mon_reg ) },
  { LSTRKEY( "eventMonStart" ), LFUNCVAL ( wifi_station_event_mon_start ) },
  { LSTRKEY( "eventMonStop" ), LFUNCVAL ( wifi_station_event_mon_stop ) },
  { LNILKEY, LNILVAL }
开发者ID:tjclement,项目名称:nodemcu-firmware,代码行数:31,代码来源:wifi.c


示例8: strcpy

      case BOOT_REASON_EXPIN_RST:       strcpy(str,"EXPIN_RST");break;
      case BOOT_REASON_WDG_RST:         strcpy(str,"WDG_RST");break;
      case BOOT_REASON_WWDG_RST:        strcpy(str,"WWDG_RST");break;
      case BOOT_REASON_LOWPWR_RST:      strcpy(str,"LOWPWR_RST");break;
      case BOOT_REASON_BOR_RST:         strcpy(str,"BOR_RST");break;
      default:strcpy(str,"NONE");break;
    }
    lua_pushstring(L,str);
    return 1;
}

#define MIN_OPT_LEVEL       2
#include "lrodefs.h"
const LUA_REG_TYPE mcu_map[] =
{
  { LSTRKEY( "ver" ), LFUNCVAL( mcu_version )},
  { LSTRKEY( "info" ), LFUNCVAL( mcu_wifiinfo )},
  { LSTRKEY( "reboot" ), LFUNCVAL( mcu_reboot )},
  { LSTRKEY( "mem" ), LFUNCVAL( mcu_memory )},
  { LSTRKEY( "chipid" ), LFUNCVAL( mcu_chipid )},
  { LSTRKEY( "bootreason" ), LFUNCVAL(mcu_bootreason)},
  { LSTRKEY( "getparams" ), LFUNCVAL(get_params)},
  { LSTRKEY( "sgetparams" ), LFUNCVAL(get_sparams)},
  { LSTRKEY( "setparams" ), LFUNCVAL(set_sparams)},
  { LSTRKEY( "queuepush" ), LFUNCVAL(queue_push)},
  { LSTRKEY( "random" ), LFUNCVAL(mcu_random)},
#if LUA_OPTIMIZE_MEMORY > 0
#endif      
  {LNILKEY, LNILVAL}
};
开发者ID:fritsjek,项目名称:MICO-1,代码行数:30,代码来源:mcu.c


示例9: net_lookup

// Lua: iptype = lookup( "name" )
static int net_lookup( lua_State *L )
{
	const char *name = luaL_checkstring( L, 1 );
	elua_net_ip res;

	res = elua_net_lookup( name );
	lua_pushinteger( L, res.ipaddr );
	return 1;
}

// Module function map
#define MIN_OPT_LEVEL 2
#include "lrodefs.h"
const LUA_REG_TYPE net_map[] = {
	{ LSTRKEY( "accept" ), LFUNCVAL( net_accept ) },
	{ LSTRKEY( "packip" ), LFUNCVAL( net_packip ) },
	{ LSTRKEY( "unpackip" ), LFUNCVAL( net_unpackip ) },
	{ LSTRKEY( "connect" ), LFUNCVAL( net_connect ) },
	{ LSTRKEY( "socket" ), LFUNCVAL( net_socket ) },
	{ LSTRKEY( "close" ), LFUNCVAL( net_close ) },
	{ LSTRKEY( "send" ), LFUNCVAL( net_send ) },
	{ LSTRKEY( "recv" ), LFUNCVAL( net_recv ) },
	{ LSTRKEY( "lookup" ), LFUNCVAL( net_lookup ) },
#if LUA_OPTIMIZE_MEMORY > 0
	{ LSTRKEY( "SOCK_STREAM" ), LNUMVAL( ELUA_NET_SOCK_STREAM ) },
	{ LSTRKEY( "SOCK_DGRAM" ), LNUMVAL( ELUA_NET_SOCK_DGRAM ) },
	{ LSTRKEY( "ERR_OK" ), LNUMVAL( ELUA_NET_ERR_OK ) },
	{ LSTRKEY( "ERR_TIMEOUT" ), LNUMVAL( ELUA_NET_ERR_TIMEDOUT ) },
	{ LSTRKEY( "ERR_CLOSED" ), LNUMVAL( ELUA_NET_ERR_CLOSED ) },
	{ LSTRKEY( "ERR_ABORTED" ), LNUMVAL( ELUA_NET_ERR_ABORTED ) },
开发者ID:Amalinda,项目名称:ruuvitracker_fw,代码行数:31,代码来源:net.c


示例10: pio_mt_index

}
#else
extern int pio_mt_index( lua_State* L );
extern int pio_decode( lua_State *L );
#endif



// *****************************************************************************
// Pin function map

#define MIN_OPT_LEVEL 2
#include "lrodefs.h"
static const LUA_REG_TYPE pio_pin_map[] =
{
  { LSTRKEY( "setdir" ), LFUNCVAL ( pio_pin_setdir ) },
  { LSTRKEY( "output" ), LFUNCVAL( pio_pin_output ) },
  { LSTRKEY( "input" ), LFUNCVAL( pio_pin_input ) },
  { LSTRKEY( "setpull" ), LFUNCVAL( pio_pin_setpull ) },
  { LSTRKEY( "setval" ), LFUNCVAL( pio_pin_setval ) },
  { LSTRKEY( "sethigh" ), LFUNCVAL( pio_pin_sethigh ) },
  { LSTRKEY( "setlow" ), LFUNCVAL( pio_pin_setlow ) },
  { LSTRKEY( "getval" ), LFUNCVAL( pio_pin_getval ) },
  { LNILKEY, LNILVAL }
};

static const LUA_REG_TYPE pio_port_map[] =
{
  { LSTRKEY( "setdir" ), LFUNCVAL( pio_port_setdir ) },
  { LSTRKEY( "output" ), LFUNCVAL( pio_port_output ) },
  { LSTRKEY( "input" ), LFUNCVAL( pio_port_input ) },
开发者ID:rbarzic,项目名称:elua-evk1104,代码行数:31,代码来源:pio.c


示例11: luaL_error

        return luaL_error( L, "invalid number" );
      platform_uart_send( id, ( u8 )len );
    }
    else
    {
      luaL_checktype( L, s, LUA_TSTRING );
      buf = lua_tolstring( L, s, &len );
      for( i = 0; i < len; i ++ )
        platform_uart_send( id, buf[ i ] );
    }
  }
  return 0;
}

// Module function map
static const LUA_REG_TYPE uart_map[] =  {
  { LSTRKEY( "setup" ), LFUNCVAL( uart_setup ) },
  { LSTRKEY( "write" ), LFUNCVAL( uart_write ) },
  { LSTRKEY( "on" ),    LFUNCVAL( uart_on ) },
  { LSTRKEY( "alt" ),   LFUNCVAL( uart_alt ) },
  { LSTRKEY( "STOPBITS_1" ),   LNUMVAL( PLATFORM_UART_STOPBITS_1 ) },
  { LSTRKEY( "STOPBITS_1_5" ), LNUMVAL( PLATFORM_UART_STOPBITS_1_5 ) },
  { LSTRKEY( "STOPBITS_2" ),   LNUMVAL( PLATFORM_UART_STOPBITS_2 ) },
  { LSTRKEY( "PARITY_NONE" ),  LNUMVAL( PLATFORM_UART_PARITY_NONE ) },
  { LSTRKEY( "PARITY_EVEN" ),  LNUMVAL( PLATFORM_UART_PARITY_EVEN ) },
  { LSTRKEY( "PARITY_ODD" ),   LNUMVAL( PLATFORM_UART_PARITY_ODD ) },
  { LNILKEY, LNILVAL }
};

NODEMCU_MODULE(UART, "uart", uart_map, NULL);
开发者ID:Alvaro99CL,项目名称:nodemcu-firmware,代码行数:30,代码来源:uart.c


示例12: LSTRKEY

	{ LSTRKEY( "DeviceInSilentState" ),	 LINTVAL( LORA_DEVICE_IN_SILENT_STATE ) },
	{ LSTRKEY( "DeviceIsNotIdle" ),		 LINTVAL( LORA_DEVICE_DEVICE_IS_NOT_IDLE ) },
	{ LSTRKEY( "Paused" ),		         LINTVAL( LORA_PAUSED ) },
	{ LSTRKEY( "Timeout" ),		         LINTVAL( LORA_TIMEOUT ) },
	{ LSTRKEY( "JoinDenied" ),		     LINTVAL( LORA_JOIN_DENIED ) },
	{ LSTRKEY( "UnexpectedResponse" ),	 LINTVAL( LORA_UNEXPECTED_RESPONSE ) },
	{ LSTRKEY( "NotJoined" ),		     LINTVAL( LORA_NOT_JOINED ) },
	{ LSTRKEY( "RejoinNeeded" ),		 LINTVAL( LORA_REJOIN_NEEDED ) },
	{ LSTRKEY( "InvalidDataLen" ),		 LINTVAL( LORA_INVALID_DATA_LEN ) },
	{ LSTRKEY( "TransmissionFail" ),	 LINTVAL( LORA_TRANSMISSION_FAIL_ACK_NOT_RECEIVED ) },
	{ LSTRKEY( "NotSetup" ),		     LINTVAL( LORA_NOT_SETUP ) },
	{ LSTRKEY( "InvalidArgument" ),		 LINTVAL( LORA_INVALID_PARAM ) },
};

static const LUA_REG_TYPE lora_map[] = {
    { LSTRKEY( "setup" ),        LFUNCVAL( llora_setup ) }, 
    { LSTRKEY( "setDevAddr" ),   LFUNCVAL( llora_set_setDevAddr ) }, 
    { LSTRKEY( "setDevEui" ),    LFUNCVAL( llora_set_DevEui ) }, 
    { LSTRKEY( "setAppEui" ),    LFUNCVAL( llora_set_AppEui ) }, 
    { LSTRKEY( "setAppKey" ),    LFUNCVAL( llora_set_AppKey ) }, 
    { LSTRKEY( "setNwksKey" ),   LFUNCVAL( llora_set_NwkSKey ) }, 
    { LSTRKEY( "setAppsKey" ),   LFUNCVAL( llora_set_AppSKey ) }, 
    { LSTRKEY( "setAppKey" ),    LFUNCVAL( llora_set_AppKey ) }, 
    { LSTRKEY( "setDr" ),        LFUNCVAL( llora_set_Dr ) }, 
    { LSTRKEY( "setAdr" ),       LFUNCVAL( llora_set_Adr ) }, 
    { LSTRKEY( "setRetX" ),      LFUNCVAL( llora_set_RetX ) }, 
    { LSTRKEY( "setLinkChk" ),   LFUNCVAL( llora_set_LinkChk ) }, // MUST DO
    { LSTRKEY( "setRxDelay1" ),  LFUNCVAL( llora_nothing ) }, 
    { LSTRKEY( "setAr" ),        LFUNCVAL( llora_set_Ar ) }, 
    { LSTRKEY( "setRx2" ),       LFUNCVAL( llora_nothing ) }, // MUST DO
    { LSTRKEY( "setChFreq" ),    LFUNCVAL( llora_nothing ) }, // MUST DO
开发者ID:whitecatboard,项目名称:LuaOS,代码行数:31,代码来源:lora.c


示例13: luaL_checkstack

    luaL_checkstack(L, 40, "");  /* assume array is smaller than 2^40 */
    if (!lua_isnoneornil(L, 2))  /* is there a 2nd argument? */
      luaL_checktype(L, 2, LUA_TFUNCTION);  /* must be a function */
    lua_settop(L, 2);  /* make sure there are two arguments */
    auxsort(L, 1, (unsigned int)n, 0u);
  }
  return 0;
}

/* }====================================================== */


#include "modules.h"

static const LUA_REG_TYPE tab_funcs[] = {
  { LSTRKEY( "concat" ),		LFUNCVAL( tconcat ) },
#if defined(LUA_COMPAT_MAXN)
  { LSTRKEY( "maxn" ),			LFUNCVAL( maxn ) },
#endif
  { LSTRKEY( "insert" ),		LFUNCVAL( tinsert ) },
  { LSTRKEY( "pack" ),			LFUNCVAL( pack ) },
  { LSTRKEY( "unpack" ),		LFUNCVAL( unpack ) },
  { LSTRKEY( "remove" ),		LFUNCVAL( tremove ) },
  { LSTRKEY( "move" ),			LFUNCVAL( tmove ) },
  { LSTRKEY( "sort" ),			LFUNCVAL( sort ) },
  { LNILKEY, LNILVAL }
};


LUAMOD_API int luaopen_table (lua_State *L) {
 #if !LUA_USE_ROTABLE
开发者ID:whitecatboard,项目名称:LuaOS,代码行数:31,代码来源:ltablib.c


示例14: MicoUartSend

      MicoUartSend( LUA_USR_UART,(char*)len,1);
    }
    else
    {
      luaL_checktype( L, s, LUA_TSTRING );
      buf = lua_tolstring( L, s, &len );
      MicoUartSend( LUA_USR_UART, buf,len);
    }
  }
  return 0;
}
#define MIN_OPT_LEVEL   2
#include "lrodefs.h"
const LUA_REG_TYPE uart_map[] =
{
  { LSTRKEY( "setup" ), LFUNCVAL( uart_setup )},
  { LSTRKEY( "on" ), LFUNCVAL( uart_on )},
  { LSTRKEY( "send" ), LFUNCVAL( uart_send )},
#if LUA_OPTIMIZE_MEMORY > 0
#endif      
  {LNILKEY, LNILVAL}
};

LUALIB_API int luaopen_uart(lua_State *L)
{
#if LUA_OPTIMIZE_MEMORY > 0
    return 0;
#else  
  luaL_register( L, EXLIB_UART, uart_map );
  return 1;
#endif
开发者ID:SmartArduino,项目名称:MICO-1,代码行数:31,代码来源:uart.c


示例15: luaL_checkinteger

  y      = luaL_checkinteger(L, 3);
  width  = luaL_checkinteger(L, 4);
  height = luaL_checkinteger(L, 5);
  lm3s_disp_imageDraw(( const unsigned char* )img, x, y, width, height);
  return 0; 
}   



#define MIN_OPT_LEVEL 2
#include "lrodefs.h"  

// Module function map
const LUA_REG_TYPE disp_map[] =
{ 
  { LSTRKEY( "init" ),  LFUNCVAL( disp_init ) },
  { LSTRKEY( "enable" ),  LFUNCVAL( disp_enable ) },
  { LSTRKEY( "disable" ), LFUNCVAL( disp_disable ) },
  { LSTRKEY( "on" ), LFUNCVAL( disp_on ) },    
  { LSTRKEY( "off" ), LFUNCVAL( disp_off ) },
  { LSTRKEY( "clear" ), LFUNCVAL( disp_clear ) },
  { LSTRKEY( "print" ), LFUNCVAL( disp_stringDraw ) },
  { LSTRKEY( "draw" ), LFUNCVAL( disp_imageDraw ) },  
  { LNILKEY, LNILVAL }
};

LUALIB_API int luaopen_disp( lua_State *L )
{
  LREGISTER( L, AUXLIB_DISP, disp_map );
}  
开发者ID:BackupTheBerlios,项目名称:elua-svn,代码行数:30,代码来源:disp.c


示例16: pushresult

    return pushresult(L, fflush(getiofile(L, IO_OUTPUT)) == 0, NULL);
}


static int f_flush (lua_State *L) {
    return pushresult(L, fflush(tofile(L)) == 0, NULL);
}

#define MIN_OPT_LEVEL 2
#include "lrodefs.h"
#if LUA_OPTIMIZE_MEMORY == 2
const LUA_REG_TYPE iolib_funcs[] = {
#else
const LUA_REG_TYPE iolib[] = {
#endif
    {LSTRKEY("close"), LFUNCVAL(io_close)},
    {LSTRKEY("flush"), LFUNCVAL(io_flush)},
    {LSTRKEY("input"), LFUNCVAL(io_input)},
    {LSTRKEY("lines"), LFUNCVAL(io_lines)},
    {LSTRKEY("open"), LFUNCVAL(io_open)},
    {LSTRKEY("output"), LFUNCVAL(io_output)},
    {LSTRKEY("popen"), LFUNCVAL(io_popen)},
    {LSTRKEY("read"), LFUNCVAL(io_read)},
    {LSTRKEY("tmpfile"), LFUNCVAL(io_tmpfile)},
    {LSTRKEY("type"), LFUNCVAL(io_type)},
    {LSTRKEY("write"), LFUNCVAL(io_write)},
    {LNILKEY, LNILVAL}
};

#if LUA_OPTIMIZE_MEMORY == 2
static int luaL_index(lua_State *L) {
开发者ID:xiqingping,项目名称:embedded_template,代码行数:31,代码来源:liolib.c


示例17: lua_pushinteger

    lua_pushinteger( L, idtype );
    lua_pushlstring( L, ( const char * )data, ( size_t )len );
  
    return 3;
  }
  else
    return 0;
}


// Module function map
#define MIN_OPT_LEVEL 2
#include "lrodefs.h"
const LUA_REG_TYPE can_map[] = 
{
  { LSTRKEY( "setup" ),  LFUNCVAL( can_setup ) },
  { LSTRKEY( "send" ),  LFUNCVAL( can_send ) },  
  { LSTRKEY( "recv" ),  LFUNCVAL( can_recv ) },
#if LUA_OPTIMIZE_MEMORY > 0
  { LSTRKEY( "ID_STD" ), LNUMVAL( ELUA_CAN_ID_STD ) },
  { LSTRKEY( "ID_EXT" ), LNUMVAL( ELUA_CAN_ID_EXT ) },
#endif
  { LNILKEY, LNILVAL }
};

LUALIB_API int luaopen_can( lua_State *L )
{
#if LUA_OPTIMIZE_MEMORY > 0
  return 0;
#else // #if LUA_OPTIMIZE_MEMORY > 0
  luaL_register( L, AUXLIB_CAN, can_map );
开发者ID:Blue-Design,项目名称:elua,代码行数:31,代码来源:can.c


示例18: strtol

  res = strtol( key + 4, &pend, 10 );
  if( *pend != '\0' )
    return 0;
  if( res >= VTMR_NUM_TIMERS )
    return 0;
  lua_pushinteger( L, VTMR_FIRST_ID + res );
  return 1;
}
#endif // #if VTMR_NUM_TIMERS > 0

// Module function map
#define MIN_OPT_LEVEL 2
#include "lrodefs.h"
const LUA_REG_TYPE tmr_map[] = 
{
  { LSTRKEY( "delay" ), LFUNCVAL( tmr_delay ) },
  { LSTRKEY( "read" ), LFUNCVAL( tmr_read ) },
  { LSTRKEY( "start" ), LFUNCVAL( tmr_start ) },
  { LSTRKEY( "gettimediff" ), LFUNCVAL( tmr_gettimediff ) },
  { LSTRKEY( "getdiffnow" ), LFUNCVAL( tmr_getdiffnow ) },
  { LSTRKEY( "getmindelay" ), LFUNCVAL( tmr_getmindelay ) },
  { LSTRKEY( "getmaxdelay" ), LFUNCVAL( tmr_getmaxdelay ) },
  { LSTRKEY( "setclock" ), LFUNCVAL( tmr_setclock ) },
  { LSTRKEY( "getclock" ), LFUNCVAL( tmr_getclock ) },
#ifdef BUILD_LUA_INT_HANDLERS
  { LSTRKEY( "set_match_int" ), LFUNCVAL( tmr_set_match_int ) },
#endif  
#if LUA_OPTIMIZE_MEMORY > 0 && VTMR_NUM_TIMERS > 0
  { LSTRKEY( "__metatable" ), LROVAL( tmr_map ) },
#endif
#if VTMR_NUM_TIMERS > 0  
开发者ID:GuoZhiyong,项目名称:elua,代码行数:31,代码来源:tmr.c


示例19: math_randomseed

  return 1;
}

#endif


static int math_randomseed (lua_State *L) {
  srand(luaL_checkint(L, 1));
  return 0;
}

#define MIN_OPT_LEVEL 1
#include "lrodefs.h"
const LUA_REG_TYPE math_map[] = {
#ifdef LUA_NUMBER_INTEGRAL
  {LSTRKEY("abs"),   LFUNCVAL(math_abs)},
  {LSTRKEY("ceil"),  LFUNCVAL(math_identity)},
  {LSTRKEY("floor"), LFUNCVAL(math_identity)},
  {LSTRKEY("max"),   LFUNCVAL(math_max)},
  {LSTRKEY("min"),   LFUNCVAL(math_min)},
  {LSTRKEY("pow"),   LFUNCVAL(math_pow)},
  {LSTRKEY("random"),     LFUNCVAL(math_random)},
  {LSTRKEY("randomseed"), LFUNCVAL(math_randomseed)},
  {LSTRKEY("sqrt"),  LFUNCVAL(math_sqrt)},
#if LUA_OPTIMIZE_MEMORY > 0
  {LSTRKEY("huge"),  LNUMVAL(LONG_MAX)},
#endif
#else
  {LSTRKEY("abs"),   LFUNCVAL(math_abs)},
  // {LSTRKEY("acos"),  LFUNCVAL(math_acos)},
  // {LSTRKEY("asin"),  LFUNCVAL(math_asin)},
开发者ID:AmenophisIII,项目名称:nodemcu-firmware,代码行数:31,代码来源:lmathlib.c


示例20: math_randomseed

  return 1;
}

#endif


static int math_randomseed (lua_State *L) {
  srand(luaL_checkint(L, 1));
  return 0;
}

#define MIN_OPT_LEVEL 1
#include "lrodefs.h"
const LUA_REG_TYPE math_map[] = {
#ifdef LUA_NUMBER_INTEGRAL
  {LSTRKEY("abs"),   LFUNCVAL(math_abs)},
  {LSTRKEY("max"),   LFUNCVAL(math_max)},
  {LSTRKEY("min"),   LFUNCVAL(math_min)},
  {LSTRKEY("random"),     LFUNCVAL(math_random)},
  {LSTRKEY("randomseed"), LFUNCVAL(math_randomseed)},
  {LSTRKEY("sqrt"),  LFUNCVAL(math_sqrt)},
#if LUA_OPTIMIZE_MEMORY > 0
  {LSTRKEY("huge"),  LNUMVAL(LONG_MAX)},
#endif
#else
  {LSTRKEY("abs"),   LFUNCVAL(math_abs)},
  {LSTRKEY("acos"),  LFUNCVAL(math_acos)},
  {LSTRKEY("asin"),  LFUNCVAL(math_asin)},
  {LSTRKEY("atan2"), LFUNCVAL(math_atan2)},
  {LSTRKEY("atan"),  LFUNCVAL(math_atan)},
  {LSTRKEY("ceil"),  LFUNCVAL(math_ceil)},
开发者ID:Sciumo,项目名称:elua,代码行数:31,代码来源:lmathlib.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ LF_ISSET函数代码示例发布时间:2022-05-30
下一篇:
C++ LFATAL函数代码示例发布时间: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