7:3 ½ˆÆ�þ^�Õ›”€r@·Ä?Ô ƒ™ÓžÐ·½/*============================================================================= Copyright (c) 2001-2014 Joel de Guzman Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ #if !defined(BOOST_SPIRIT_X3_NO_CASE_STRING_PARSE_APR_18_2014_1125PM) #define BOOST_SPIRIT_X3_NO_CASE_STRING_PARSE_APR_18_2014_1125PM #include #include namespace boost { namespace spirit { namespace x3 { namespace detail { template struct no_case_string { typedef std::basic_string< Char > string_type; typedef typename string_type::const_iterator const_iterator; no_case_string(char_type const* str) : lower(str) , upper(str) { typename string_type::iterator loi = lower.begin(); typename string_type::iterator upi = upper.begin(); typedef typename Encoding::char_type encoded_char_type; Encoding encoding; for (; loi != lower.end(); ++loi, ++upi) { *loi = static_cast(encoding.tolower(encoded_char_type(*loi))); *upi = static_cast(encoding.toupper(encoded_char_type(*upi))); } } string_type lower; string_type upper; }; template inline bool no_case_string_parse( String const& str , Iterator& first, Iterator const& last, Attribute& attr) { typename String::const_iterator uc_i = str.upper.begin(); typename String::const_iterator uc_last = str.upper.end(); typename String::const_iterator lc_i = str.lower.begin(); Iterator i = first; for (; uc_i != uc_last; ++uc_i, ++lc_i, ++i) if (i == last || ((*uc_i != *i) && (*lc_i != *i))) return false; x3::traits::move_to(first, i, attr); first = i; return true; } }}}} #endif ¿ˆÄ�þDû…Y¹]x®´>Ó@þÔ „ŸÓ¾Ð)n¿----------------------------------------------------------------------------- -- FTP support for the Lua language -- LuaSocket toolkit. -- Author: Diego Nehab ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- -- Declare module and import dependencies ----------------------------------------------------------------------------- local base = _G local table = require("table") local string = require("string") local math = require("math") local socket = require("socket") local url = require("socket.url") local tp = require("socket.tp") local ltn12 = require("ltn12") socket.ftp = {} local _M = socket.ftp ----------------------------------------------------------------------------- -- Program constants ----------------------------------------------------------------------------- -- timeout in seconds before the program gives up on a connection _M.TIMEOUT = 60 -- default port for ftp service local PORT = 21 -- this is the default anonymous password. used when no password is -- provided in url. should be changed to your e-mail. _M.USER = "ftp" _M.PASSWORD = "anonymous@anonymous.org" ----------------------------------------------------------------------------- -- Low level FTP API ----------------------------------------------------------------------------- local metat = { __index = {} } function _M.open(server, port, create) local tp = socket.try(tp.connect(server, port or PORT, _M.TIMEOUT, create)) local f = base.setmetatable({ tp = tp }, metat) -- make sure everything gets closed in an exception f.try = socket.newtry(function() f:close() end) return f end function metat.__index:portconnect() self.try(self.se