text:
6" y1="-324.612" x2="-1.27" y2="-164.846" width="0" layer="19" extent="1-1"/>
</signal>
<signal name="N$12">
<contactref element="IC2" pad="4"/>
<contactref element="R9" pad="1"/>
<wire x1="-6.096" y1="-337.82" x2="1.27" y2="-164.846" width="0" layer="19" extent="1-1"/>
</signal>
<signal name="VREF+">
<contactref element="C38" pad="2"/>
<contactref element="R22" pad="2"/>
<contactref element="C35" pad="+"/>
<contactref element="U1" pad="21"/>
<wire x1="-29.718" y1="-1035.812" x2="-39.176" y2="-361.124" width="0" layer="19" extent="1-1"/>
<wire x1="-23.876" y1="-1050.544" x2="-29.718" y2="-1035.812" width="0" layer="19" extent="1-1"/>
<wire x1="-22.248" y1="-1073.404" x2="-23.876" y2="-1050.544" width="0" layer="19" extent="1-1"/>
</signal>
<signal name="N$1">
<contactref element="ADC" pad="1"/>
<contactref element="C7" pad="1"/>
<wire x1="-11.511" y1="-143.013" x2="-34.036" y2="-438.912" width="0" layer="19" extent="1-1"/>
</signal>
<signal name="RIN">
<contactref element="C8" pad="1"/>
</signal>
<signal name="LIN">
<contactref element="C9" pad="1"/>
</signal>
<signal name="GNDA">
<contactref element="C7" pad="2"/>
<contactref element="C5" pad="2"/>
<contactref element="R1" pad="1"/>
<contactref element="U$1" pad="S"/>
<contactref element="IC1" pad="4"/>
<contactref element="R3" pad="1"/>
<contactref element="C10" pad="2"/>
<contactref element="C11" pad="2"/>
<contactref element="ADC" pad="4"/>
<contactref element="C12" pad="2"/>
<contactref element="C13" pad="1"/>
<contactref element="C14" pad="2"/>
<contactref element="R13" pad="1"/>
<contactref element="C16" pad="1"/>
<contactref element="DAC" pad="15"/>
<contactref element="C17" pad="2"/>
<contactref element="C18" pad="2"/>
<contactref element="C19" pad="2"/>
<contactref element="DAC" pad="12"/>
<contactref element="C20" pad="1"/>
<contactref element="C21" pad="2"/>
<contactref element="U$2" pad="S"/>
<wire x1="-28.956" y1="-484.632" x2="-28.956" y2="-438.912" width="0" layer="19" extent="1-1"/>
<wire x1="-28.956" y1="-497.84" x2="-28.956" y2="-484.632" width="0" layer="19" extent="1-1"/>
<wire x1="-29.718" y1="-512.572" x2="-28.956" y2="-497.84" width="0" layer="19" extent="1-1"/>
<wire x1="-32.258" y1="-528.828" x2="-29.718" y2="-512.572" width="0" layer="19" extent="1-1"/>
<wire x1="-28.956" y1="-543.56" x2="-32.258" y2="-528.828" width="0" layer="19" extent="1-1"/>
<wire x1="-34.036" y1="-556.768" x2="-28.956" y2="-543.56" width="0" layer="19" extent="1-1"/>
<wire x1="-34.036" y1="-583.184" x2="-34.036" y2="-556.768" width="0" layer="19" extent="1-1"/>
<wire x1="-28.956" y1="-596.392" x2="-34.036" y2="-583.184" width="0" layer="19" extent="1-1"/>
<wire x1="-29.718" y1="-611.124" x2="-28.956" y2="-596.392" width="0" layer="19" extent="1-1"/>
<wire x1="-28.956" y1="-625.856" x2="-29.718" y2="-611.124" width="0" layer="19" extent="1-1"/>
<wire x1="-34.036" y1="-639.064" x2="-28.956" y2="-625.856" width="0" layer="19" extent="1-1"/>
<wire x1="-29.718" y1="-653.796" x2="-34.036" y2="-639.064" width="0" layer="19" extent="1-1"/>
<wire x1="-31.242" y1="-668.528" x2="-29.718" y2="-653.796" width="0" layer="19" extent="1-1"/>
<wire x1="-14.905" y1="-352.877" x2="-28.956" y2="-438.912" width="0" layer="19" extent="1-1"/>
<wire x1="-14.905" y1="-350.927" x2="-14.905" y2="-352.877" width="0" layer="19" extent="1-1"/>
<wire x1="-11.511" y1="-144.963" x2="-14.905" y2="-350.927" width="0" layer="19" extent="1-1"/>
<wire x1="5.334" y1="-117.348" x2="-11.511" y2="-144.963" width="0" layer="19" extent="1-1"/>
<wire x1="2.54" y1="-104.14" x2="5.334" y2="-117.348" width="0" layer="19" extent="1-1"/>
<wire x1="6.858" y1="-30.48" x2="2.54" y2="-104.14" width="0" layer="19" extent="1-1"/>
<wire x1="10.414" y1="-15.494" x2="6.858" y2="-30.48" width="0" layer="19" extent="1-1"/>
<wire x1="2.54" y1="10.16" x2="10.414" y2="-15.494" width="0" layer="19" extent="1-1"/>
</signal>
<signal name="N$17">
<contactref element="ADC" pad="8"/>
<contactref element="C10" pad="1"/>
<wire x1="-34.036" y1="-484.632" x2="-11.511" y2="-147.563" width="0" layer="19" extent="1-1"/>
</signal>
<signal name="VCC">
<contactref element="C11" pad="1"/>
<contactref element="C12" pad="1"/>
<contactref element="ADC" pad="5"/>
<contactref element="C18" pad="1"/>
<contactref element="C17" pad="1"/>
<contactref element="DAC" pad="14"/>
<contactref element="DAC" pad="11"/>
<contactref element="C21" pad="1"/>
<contactref element="C20" pad="2"/>
<wire x1="-28.956" y1="-639.064" x2="-32.258" y2="-653.796" width="0" layer="19" extent="1-1"/>
<wire x1="-32.258" y1="-611.124" x2="-28.956" y2="-639.064" width="0" layer="19" extent="1-1"/>
<wire x1="-34.036" y1="-596.392" x2="-32.258" y2="-611.124" width="0" layer="19" extent="1-1"/>
<wire x1="-32.258" y1="-512.572" x2="-34.036" y2="-596.392" width="0" layer="19" extent="1-1"/>
<wire x1="-34.036" y1="-497.84" x2="-32.258" y2="-512.572" width="0" layer="19" extent="1-1"/>
<wire x1="-14.905" y1="-353.527" x2="-34.036" y2="-497.84" width="0" layer="19" extent="1-1"/>
<wire x1="-14.905" y1="-351.577" x2="-14.905" y2="-353.527" width="0" layer="19" extent="1-1"/>
<wire x1="-11.511" y1="-145.613" x2="-14.905" y2="-351.577" width="0" layer="19" extent="1-1"/>
</signal>
<signal name="N$14">
<contactref element="C9" pad="2"/>
<contactref element="ADC" pad="3"/>
<wire x1="-11.511" y1="-144.313" x2="-29.718" y2="-469.9" width="0" layer="19" extent="1-1"/>
</signal>
<signal name="N$15">
<contactref element="C8" pad="2"/>
<contactref element="ADC" pad="2"/>
<wire x1="-11.511" y1="-143.663" x2="-29.718" y2="-453.644" width="0" layer="19" extent="1-1"/>
</signal>
<signal name="N$18">
<contactref element="ADC" pad="16"/>
<contactref element="R13" pad="2"/>
<wire x1="-23.876" y1="-556.768" x2="-5.761" y2="-143.013" width="0" layer="19" extent="1-1"/>
</signal>
<signal name="FSEL">
<contactref element="ADC" pad="15"/>
</signal>
<signal name="DIF/TDMI">
<contactref element="ADC" pad="14"/>
</signal>
<signal name="ADC_RESET">
<contactref element="ADC" pad="13"/>
</signal>
<signal name="BICK_ADC">
<contactref element="ADC" pad="12"/>
</signal>
<signal name="MCLK_ADC">
<contactref element="ADC" pad="11"/>
</signal>
<signal name="LRCK_ADC">
<contactref element="ADC" pad="10"/>
</signal>
<signal name="SDTO">
<contactref element="ADC" pad="9"/>
</signal>
<signal name="N$19">
<contactref element="DAC" pad="1"/>
<contactref element="C15" pad="2"/>
<wire x1="-28.956" y1="-569.976" x2="-20.655" y2="-350.277" width="0" layer="19" extent="1-1"/>
</signal>
<signal name="N$20">
<contactref element="DAC" pad="2"/>
<contactref element="C15" pad="1"/>
<wire x1="-34.036" y1="-569.976" x2="-20.655" y2="-350.927" width="0" layer="19" extent="1-1"/>
</signal>
<signal name="N$16">
<contactref element="DAC" pad="16"/>
<contactref element="C16" pad="2"/>
<wire x1="-28.956" y1="-583.184" x2="-14.905" y2="-350.277" width="0" layer="19" extent="1-1"/>
</signal>
<signal name="N$21">
<contactref element="C19" pad="1"/>
<contactref element="DAC" pad="13"/>
<wire x1="-14.905" y1="-352.227" x2="-34.036" y2="-625.856" width="0" layer="19" extent="1-1"/>
</signal>
<signal name="AOUTL">
<contactref element="DAC" pad="10"/>
</signal>
<signal name="AOUTR">
<contactref element="DAC" pad="9"/>
<contactref element="U$2" pad="T"/>
<wire x1="-14.905" y1="-354.827" x2="-33.782" y2="-668.528" width="0" layer="19" extent="1-1"/>
</signal>
<signal name="SMUTE">
<contactref element="DAC" pad="3"/>
</signal>
<signal name="MCLK_DAC">
<contactref element="DAC" pad="4"/>
</signal>
<signal name="BICK_DAC">
<contactref element="DAC" pad="5"/>
</signal>
<signal name="DATA_OUT">
<contactref element="DAC" pad="6"/>
<contactref element="R9" pad="2"/>
<contactref element="R10" pad="1"/>
<contactref element="IC2" pad="5"/>
<contactref element="IC2" pad="6"/>
<wire x1="6.35" y1="-164.846" x2="3.81" y2="-164.846" width="0" layer="19" extent="1-1"/>
<wire x1="4.064" y1="-337.82" x2="3.81" y2="-164.846" width="0" layer="19" extent="1-1"/>
<wire x1="-6.096" y1="-351.028" x2="4.064" y2="-337.82" width="0" layer="19" extent="1-1"/>
<wire x1="-20.655" y1="-353.527" x2="-6.096" y2="-351.028" width="0" layer="19" extent="1-1"/>
</signal>
<signal name="LRCK_DAC">
<contactref element="DAC" pad="7"/>
</signal>
<signal name="DIF">
<contactref element="DAC" pad="8"/>
</signal>
<signal name="N$13">
<contactref element="R16" pad="2"/>
<contactref element="Y1" pad="2"/>
<contactref element="C23" pad="1"/>
<wire x1="-23.876" y1="-694.944" x2="-32.258" y2="-725.932" width="0" layer="19" extent="1-1"/>
<wire x1="-15.706" y1="-363.22" x2="-23.876" y2="-694.944" width="0" layer="19" extent="1-1"/>
</signal>
<signal name="N$22">
<contactref element="R15" pad="2"/>
<contactref element="Y1" pad="1"/>
<contactref element="C22" pad="1"/>
<wire x1="-23.876" y1="-681.736" x2="-32.258" y2="-709.676" width="0" layer="19" extent="1-1"/>
<wire x1="-16.806" y1="-363.22" x2="-23.876" y2="-681.736" width="0" layer="19" extent="1-1"/>
</signal>
<signal name="PH0">
<contactref element="R15" pad="1"/>
<contactref element="U1" pad="12"/>
<wire x1="-39.176" y1="-356.624" x2="-34.036" y2="-681.736" width="0" layer="19" extent="1-1"/>
</signal>
<signal name="PH1">
<contactref element="R16" pad="1"/>
<contactref element="U1" pad="13"/>
<wire x1="-39.176" y1="-357.124" x2="-34.036" y2="-694.944" width="0" layer="19" extent="1-1"/>
</signal>
<signal name="N$23">
<contactref element="R17" pad="2"/>
<contactref element="U1" pad="27"/>
<contactref element="U1" pad="10"/>
<contactref element="U1" pad="99"/>
<contactref element="U1" pad="74"/>
<contactref element="R18" pad="2"/>
<wire x1="-39.176" y1="-355.624" x2="-36.996" y2="-364.804" width="0" layer="19" extent="1-1"/>
<wire x1="-36.996" y1="-349.444" x2="-39.176" y2="-355.624" width="0" layer="19" extent="1-1"/>
<wire x1="-23.816" y1="-351.624" x2="-36.996" y2="-349.444" width="0" layer="19" extent="1-1"/>
<wire x1="-23.876" y1="-740.664" x2="-36.996" y2="-364.804" width="0" layer="19" extent="1-1"/>
<wire x1="-23.876" y1="-753.872" x2="-23.876" y2="-740.664" width="0" layer="19" extent="1-1"/>
</signal>
<signal name="NRST">
<contactref element="U1" pad="14"/>
</signal>
<signal name="N$24">
<contactref element="U1" pad="49"/>
<contactref element="C24" pad="1"/>
<wire x1="-32.258" y1="-768.604" x2="-25.996" y2="-364.804" width="0" layer="19" extent="1-1"/>
</signal>
<signal name="N$25">
<contactref element="U1" pad="73"/>
<contactref element="C25" pad="1"/>
<wire x1="-32.258" y1="-784.86" x2="-23.816" y2="-352.124" width="0" layer="19" extent="1-1"/>
</signal>
<signal name="PB6">
<contactref element="U1" pad="92"/>
<contactref element="R19" pad="1"/>
<wire x1="-34.036" y1="-799.592" x2="-33.496" y2="-349.444" width="0" layer="19" extent="1-1"/>
</signal>
<signal name="PB9">
<contactref element="U1" pad="96"/>
<contactref element="R20" pad="1"/>
<wire x1="-34.036" y1="-812.8" x2="-35.496" y2="-349.444" width="0" layer="19" extent="1-1"/>
</signal>
<signal name="VDD">
<contactref element="U1" pad="50"/>
<contactref element="U1" pad="75"/>
<contactref element="U1" pad="19"/>
<contactref element="U1" pad="28"/>
<contactref element="U1" pad="11"/>
<contactref element="U1" pad="100"/>
<wire x1="-39.176" y1="-360.124" x2="-36.496" y2="-364.804" width="0" layer="19" extent="1-1"/>
<wire x1="-39.176" y1="-356.124" x2="-39.176" y2="-360.124" width="0" layer="19" extent="1-1"/>
<wire x1="-37.496" y1="-349.444" x2="-39.176" y2="-356.124" width="0" layer="19" extent="1-1"/>
<wire x1="-25.496" y1="-364.804" x2="-36.496" y2="-364.804" width="0" layer="19" extent="1-1"/>
<wire x1="-23.816" y1="-351.124" x2="-37.496" y2="-349.444" width="0" layer="19" extent="1-1"/>
</signal>
<signal name="VDDA">
<contactref element="U1" pad="22"/>
<contactref element="L1" pad="2"/>
<contactref element="R22" pad="1"/>
<contactref element="C37" pad="+"/>
<contactref element="C36" pad="1"/>
<wire x1="-32.258" y1="-1003.3" x2="-39.176" y2="-361.624" width="0" layer="19" extent="1-1"/>
<wire x1="-34.036" y1="-1050.544" x2="-32.258" y2="-1003.3" width="0" layer="19" extent="1-1"/>
<wire x1="-30.012" y1="-1062.736" x2="-34.036" y2="-1050.544" width="0" layer="19" extent="1-1"/>
<wire x1="-22.248" y1="-1083.056" x2="-30.012" y2="-1062.736" width="0" layer="19" extent="1-1"/>
</signal>
<signal name="N$28">
<contactref element="C38" pad="1"/>
<contactref element="C36" pad="2"/>
<wire x1="-29.718" y1="-1003.3" x2="-32.258" y2="-1035.812" width="0" layer="19" extent="1-1"/>
</signal>
</signals>
</board>
</drawing>
</eagle>


text:
/*
 * zsummerX License
 * -----------
 *
 * zsummerX is licensed under the terms of the MIT license reproduced below.
 * This means that zsummerX is free software and can be used for both academic
 * and commercial purposes at absolutely no cost.
 *
 *
 * ===============================================================================
 *
 * Copyright (C) 2010-2015 YaweiZhang <yawei.zhang@foxmail.com>.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 * ===============================================================================
 *
 * (end of COPYRIGHT)
 */

#include "summer.h"

#include <zsummerX/zsummerX.h>
using namespace zsummer::proto4z;
using namespace zsummer::network;

static int logt(lua_State * L)
{
    const char * log = luaL_checkstring(L, 1);
    LOGT("from lua: " << log);
    return 0;
}
static int logd(lua_State * L)
{
    const char * log = luaL_checkstring(L, 1);
    LOGD("from lua: " << log);
    return 0;
}
static int logi(lua_State * L)
{
    const char * log = luaL_checkstring(L, 1);
    LOGI("from lua: " << log);
    return 0;
}
static int logw(lua_State * L)
{
    const char * log = luaL_checkstring(L, 1);
    LOGW("from lua: " << log);
    return 0;
}
static int loge(lua_State * L)
{
    const char * log = luaL_checkstring(L, 1);
    LOGE("from lua: " << log);
    return 0;
}
static int logf(lua_State * L)
{
    const char * log = luaL_checkstring(L, 1);
    LOGF("from lua: " << log);
    return 0;
}
static int loga(lua_State * L)
{
    const char * log = luaL_checkstring(L, 1);
    LOGA("from lua: " << log);
    return 0;
}

static int pcall_error(lua_State* L)
{
    lua_getglobal(L, "debug");
    if (!lua_istable(L, -1)) {
        lua_pop(L, 1);
        return 1;
    }
    lua_getfield(L, -1, "traceback");
    if (!lua_isfunction(L, -1)) {
        lua_pop(L, 2);
        return 1;
    }
    lua_pushvalue(L, 1);
    lua_pushinteger(L, 2);
    lua_call(L, 2, 1);
    return 1;
}

//////////////////////////////////////////////////////////////////////////

static int _connectCB = LUA_NOREF;
static int _messageCB = LUA_NOREF;
static int _disconnectCB = LUA_NOREF;

//在回调前检测模块是否已经被卸载
static std::vector<lua_State*> _vmCheck;

void onStopServersFinish()
{
    SessionManager::getRef().stop();
}

void onStopClientsFinish()
{
    SessionManager::getRef().stopServers();
}

static int start(lua_State *L)
{
    SessionManager::getRef().start();
    SessionManager::getRef().setStopClientsHandler(onStopClientsFinish);
    SessionManager::getRef().setStopServersHandler(onStopServersFinish);
    return 0;
}

static int stop(lua_State *L)
{
    SessionManager::getRef().stopAccept();
    SessionManager::getRef().stopClients();
    return 0;
}

static int runOnce(lua_State * L)
{
    bool isImmediately = false;
    if (lua_gettop(L) > 0 && !lua_isnil(L, -1))
    {
        isImmediately = true;
    }
    bool ret = SessionManager::getRef().runOnce(isImmediately);
    lua_pushboolean(L, ret);
    return 1;
}

static int addConnect(lua_State *L)
{
    int argc = lua_gettop(L);
    if (argc != 1)
    {
        LOGE("addConnect error. argc is not 1.  the argc=" << argc);
        lua_settop(L, 0);
        lua_pushnil(L);
        return 1;
    }

    ConnectConfig config;

    {
        lua_getfield(L, 1, "ip");
        if (lua_isnil(L, -1))
        {
            lua_settop(L, 0);
            lua_pushnil(L);
            return 1;
        }
        else
        {
            size_t len = 0;
            const char * str = luaL_checklstring(L, -1, &len);
            if (str && len > 0)
            {
                config._remoteIP.clear();
                config._remoteIP.append(str, len);
            }
        }

    }

    {
        lua_getfield(L, 1, "port");
        if (lua_isnil(L, -1))
        {
            lua_settop(L, 0);
            lua_pushnil(L);
            return 1;
        }
        else
        {
            config._remotePort = (unsigned short)luaL_checknumber(L, -1);
        }
    }

    {
        lua_getfield(L, 1, "key");
        if (!lua_isnil(L, -1))
        {
            size_t len = 0;
            const char * str = luaL_checklstring(L, -1, &len);
            if (str && len > 0)
            {
                config._rc4TcpEncryption.clear();
                config._rc4TcpEncryption.append(str, len);
            }
        }
    }

    {
        lua_getfield(L, 1, "reconnect");
        if (!lua_isnil(L, -1))
        {
            config._reconnectMaxCount = (unsigned int)luaL_checknumber(L, -1);
        }
    }

    {
        lua_getfield(L, 1, "interval");
        if (!lua_isnil(L, -1))
        {
            config._pulseInterval = (unsigned int)luaL_checknumber(L, -1);
        }
    }

    lua_settop(L, 0);
    LOGD("lua: addConnect:" << config);
    SessionID id = SessionManager::getRef().addConnector(config);
    if (id == InvalidSeesionID)
    {
        lua_pushnil(L);
    }
    else
    {
        lua_pushnumber(L, id);
    }
    return 1;
}

static int addListen(lua_State *L)
{
    int argc = lua_gettop(L);
    if (argc != 1)
    {
        LOGE("addListen error. argc is not 1.  the argc=" << argc);
        lua_settop(L, 0);
        lua_pushnil(L);
        return 1;
    }

    ListenConfig config;

    {
        lua_getfield(L, 1, "ip");
        if (lua_isnil(L, -1))
        {
            lua_settop(L, 0);
            lua_pushnil(L);
            return 1;
        }
        else
        {
            size_t len = 0;
            const char * str = luaL_checklstring(L, -1, &len);
            if (str && len > 0)
            {
                config._listenIP.clear();
                config._listenIP.append(str, len);
            }
        }

    }

    {
        lua_getfield(L, 1, "port");
        if (lua_isnil(L, -1))
        {
            lua_settop(L, 0);
            lua_pushnil(L);
            return 1;
        }
        else
        {
            config._listenPort = (unsigned short)luaL_checknumber(L, -1);
        }
    }

    {
        lua_getfield(L, 1, "key");
        if (!lua_isnil(L, -1))
        {
            size_t len = 0;
            const char * str = luaL_checklstring(L, -1, &len);
            if (str && len > 0)
            {
                config._rc4TcpEncryption.clear();
                config._rc4TcpEncryption.append(str, len);
            }
        }
    }

    {
        lua_getfield(L, 1, "maxSessions");
        if (!lua_isnil(L, -1))
        {
            config._maxSessions = (unsigned int)luaL_checknumber(L, -1);
        }
    }

    {
        lua_getfield(L, 1, "interval");
        if (!lua_isnil(L, -1))
        {
            config._pulseInterval = (unsigned int)luaL_checknumber(L, -1);
        }
    }

    lua_settop(L, 0);
    LOGD("lua: addListen:" << config);
    AccepterID id = SessionManager::getRef().addAcceptor(config);
    if (id == InvalidAccepterID)
    {
        lua_pushnil(L);
    }
    else
    {
        lua_pushnumber(L, id);
    }
    return 1;
}

static void _onConnecterCallback(lua_State * L, TcpSessionPtr session)
{
    auto founder = std::find_if(_vmCheck.begin(), _vmCheck.end(), [L](lua_State* l){return l == L; });
    if (founder == _vmCheck.end())
    {
        LOGW("_onConnecterCallback _vmCheck warning: L is not found . L=" << L);
        return;
    }
    if (_connectCB == LUA_NOREF)
    {
        LOGW("_onConnecterCallback warning: cannot found ther callback. L=" << L);
        return;
    }
    int index = lua_gettop(L);
    lua_pushcfunction(L, pcall_error);
    lua_rawgeti(L, LUA_REGISTRYINDEX, _connectCB);
    if (lua_isnil(L, -1))
    {
        LOGW("_onConnecterCallback warning: cannot found ther callback. L=" << L << ", ref=" << _connectCB);
        lua_settop(L, 0);
        return;
    }

    lua_pushnumber(L, session->getSessionID());
    lua_pushstring(L, session->getRemoteIP().c_str());
    lua_pushnumber(L, session->getRemotePort());
    int status = lua_pcall(L, 3, 0, index+1);
    if (status && !lua_isnil(L, -1))
    {
        const char *msg = lua_tostring(L, -1);
        if (msg == NULL) msg = "(error object is not a string)";
        LOGE(msg);
        lua_pop(L, 1);
    }
}

static int registerConnect(lua_State * L)
{
    int index = lua_gettop(L);
    if (index != 1)
    {
        LOGE("registerConnect error. argc is not 1.  the argc=" << index);
        lua_settop(L, 0);
        return 0;
    }
    if (_connectCB != LUA_NOREF)
    {
        LOGE("registerConnect error. connect callback already .  the argc=" << index);
        lua_settop(L, 0);
        return 0;
    }

    int ret = luaL_ref(L, LUA_REGISTRYINDEX);
    if (ret == LUA_REFNIL)
    {
        LOGE("registerConnect error. callback function is nil .  the argc=" << index);
        lua_settop(L, 0);
        return 0;
    }
    _connectCB = ret;

    MessageDispatcher::getRef().registerOnSessionEstablished(std::bind(_onConnecterCallback, L, std::placeholders::_1));
    return 0;
}

static void _onMessageCallback(lua_State * L,TcpSessionPtr session, ProtoID pID, ReadStream & rs)
{
    auto founder = std::find_if(_vmCheck.begin(), _vmCheck.end(), [L](lua_State* l){return l == L; });
    if (founder == _vmCheck.end())
    {
        LOGW("_onMessageCallback _vmCheck warning: L is not found . L=" << L);
        return;
    }
    if (_messageCB == LUA_NOREF)
    {
        LOGW("_onMessageCallback warning: cannot found ther callback. L=" << L);
        return;
    }
    int index = lua_gettop(L);
    lua_pushcfunction(L, pcall_error);
    lua_rawgeti(L, LUA_REGISTRYINDEX, _messageCB);
    if (lua_isnil(L, -1))
    {
        LOGW("_onMessageCallback warning: cannot found ther callback. L=" << L << ", ref=" << _messageCB);
        lua_settop(L, 0);
        return;
    }

    lua_pushinteger(L, session->getSessionID());
    lua_pushinteger(L, pID);
    lua_pushlstring(L, rs.getStreamBody(), rs.getStreamBodyLen());
    int status = lua_pcall(L, 3, 0, index + 1);
    if (status && !lua_isnil(L, -1))
    {
        const char *msg = lua_tostring(L, -1);
        if (msg == NULL) msg = "(error object is not a string)";
        LOGE(msg);
        lua_pop(L, 1);
    }
}

static int registerMessage(lua_State * L)
{
    int index = lua_gettop(L);
    if (index != 1)
    {
        LOGE("registerMessage error. argc is not 1.  the argc=" << index);
        lua_settop(L, 0);
        return 0;
    }
    if (_messageCB != LUA_NOREF)
    {
        LOGE("registerMessage error. connect callback already .  the argc=" << index);
        lua_settop(L, 0);
        return 0;
    }

    int ret = luaL_ref(L, LUA_REGISTRYINDEX);
    if (ret == LUA_REFNIL)
    {
        LOGE("registerMessage error. callback function is nil .  the argc=" << index);
        lua_settop(L, 0);
        return 0;
    }
    _messageCB = ret;

    MessageDispatcher::getRef().registerSessionDefaultMessage(std::bind(_onMessageCallback, L, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
    return 0;
}

static void _onDisconnectCallback(lua_State * L, TcpSessionPtr session)
{
    auto founder = std::find_if(_vmCheck.begin(), _vmCheck.end(), [L](lua_State* l){return l == L; });
    if (founder == _vmCheck.end())
    {
        LOGW("_onDisconnectCallback _vmCheck warning: L is not found . L=" << L);
        return;
    }
    if (_disconnectCB == LUA_NOREF)
    {
        LOGW("_onDisconnectCallback warning: cannot found ther callback. L=" << L);
        return;
    }
    int index = lua_gettop(L);
    lua_pushcfunction(L, pcall_error);
    lua_rawgeti(L, LUA_REGISTRYINDEX, _disconnectCB);
    if (lua_isnil(L, -1))
    {
        LOGW("_onDisconnectCallback warning: cannot found ther callback. L=" << L << ", ref=" << _disconnectCB);
        lua_settop(L, 0);
        return;
    }

    lua_pushnumber(L, session->getSessionID());
    lua_pushstring(L, session->getRemoteIP().c_str());
    lua_pushnumber(L, session->getRemotePort());
    int status = lua_pcall(L, 3, 0, index + 1);
    if (status && !lua_isnil(L, -1))
    {
        const char *msg = lua_tostring(L, -1);
        if (msg == NULL) msg = "(error object is not a string)";
        LOGE(msg);
        lua_pop(L, 1);
    }
}

static int registerDisconnect(lua_State * L)
{
    int index = lua_gettop(L);
    if (index != 1)
    {
        LOGE("registerDisconnect error. argc is not 1.  the argc=" << index);
        lua_settop(L, 0);
        return 0;
    }
    if (_disconnectCB != LUA_NOREF)
    {
        LOGE("registerDisconnect error. connect callback already .  the argc=" << index);
        lua_settop(L, 0);
        return 0;
    }

    int ret = luaL_ref(L, LUA_REGISTRYINDEX);
    if (ret == LUA_REFNIL)
    {
        LOGE("registerDisconnect error. callback function is nil .  the argc=" << index);
        lua_settop(L, 0);
        return 0;
    }
    _disconnectCB = ret;

    MessageDispatcher::getRef().registerOnSessionDisconnect(std::bind(_onDisconnectCallback, L, std::placeholders::_1));
    return 0;
}

static int sendContent(lua_State * L)
{
    int index = lua_gettop(L);
    if (index != 3)
    {
        LOGE("sendContent error. argc is not 3.  the argc=" << index);
        lua_settop(L, 0);
        return 0;
    }
    SessionID sID = (SessionID)luaL_checkinteger(L, 1);
    zsummer::proto4z::ProtoInteger pID = (zsummer::proto4z::ProtoInteger)luaL_checkinteger(L, 2);

    size_t len = 0;
    const char * content = luaL_checklstring(L, 3, &len);
    WriteStream ws(pID);
    ws.appendOriginalData(content, (zsummer::proto4z::Integer)len);
    SessionManager::getRef().sendSessionData(sID, ws.getStream(), ws.getStreamLen());

    return 0;
}

static int sendData(lua_State * L)
{
    int index = lua_gettop(L);
    if (index != 2)
    {
        LOGE("sendData error. argc is not 2.  the argc=" << index);
        lua_settop(L, 0);
        return 0;
    }
    SessionID sID = (SessionID)luaL_checkinteger(L, 1);
    size_t len = 0;
    const char * data = luaL_checklstring(L, 2, &len);
    if (data == NULL || len == 0)
    {
        LOGE("sendData error. no any data.");
        lua_settop(L, 0);
        return 0;
    }

    SessionManager::getRef().sendSessionData(sID, data, (unsigned short)len);
    return 0;
}

static int kick(lua_State * L)
{
    int index = lua_gettop(L);
    if (index != 1)
    {
        LOGE("kick error. argc is not 1.  the argc=" << index);
        lua_settop(L, 0);
        return 0;
    }
    SessionID sID = (SessionID)luaL_checkinteger(L, 1);

    SessionManager::getRef().kickSession(sID);
    return 0;
}

static void onPost(lua_State * L, int delay, int refID)
{
    auto founder = std::find_if(_vmCheck.begin(), _vmCheck.end(), [L](lua_State* l){return l == L; });
    if (founder == _vmCheck.end())
    {
        LOGW("onPost _vmCheck warning: L is not found . L=" << L);
        return;
    }

    int index = lua_gettop(L);
    lua_pushcfunction(L, pcall_error);
    lua_rawgeti(L, LUA_REGISTRYINDEX, refID);
    if (lua_isnil(L, -1))
    {
        LOGW("onPost warning: cannot found ther callback. L=" << L << ", ref=" << refID);
        lua_settop(L, 0);
        return;
    }
    int status = lua_pcall(L, 0, 0, index + 1);
    if (status && !lua_isnil(L, -1))
    {
        const char *msg = lua_tostring(L, -1);
        if (msg == NULL) msg = "(error object is not a string)";
        LOGE(msg);
        lua_pop(L, 1);
    }
    luaL_unref(L, LUA_REGISTRYINDEX, refID);
}

static int _post(lua_State * L)
{
    int index = lua_gettop(L);
    if (index != 2)
    {
        LOGE("post error. argc is not 2 [delay,function].  the argc=" << index);
        lua_settop(L, 0);
        return 0;
    }

    int delay = (int)luaL_checkinteger(L, 1);
    if (!lua_isfunction(L, -1))
    {
        LOGE("post error. found out callback function.  the argc=" << index);
        lua_settop(L, 0);
    }

    int ret = luaL_ref(L, LUA_REGISTRYINDEX);
    if (ret == LUA_REFNIL)
    {
        LOGE("post error. callback function is nil .  the argc=" << index);
        lua_settop(L, 0);
        return 0;
    }
    if (delay <= 0)
    {
        SessionManager::getRef().post(std::bind(onPost, L, delay, ret));
    }
    else
    {
        SessionManager::getRef().createTimer(delay, std::bind(onPost, L, delay, ret));
    }
    return 0;
}

luaL_Reg summer[] = {
    { "logd", logd },
    { "logi", logi },
    { "logt", logt },
    { "logw", logw },
    { "loge", loge },
    { "logf", logf },
    { "loga", loga },

    { "start", start }, //start network
    { "stop", stop }, //stop network
    { "runOnce", runOnce }, //message pump, run it once.
    { "addConnect", addConnect }, //add one connect.
    { "addListen", addListen }, //add listen.
    { "registerConnect", registerConnect }, //register event when connect success.
    { "registerMessage", registerMessage }, //register event when recv message.
    { "registerDisconnect", registerDisconnect }, //register event when disconnect.
    { "sendContent", sendContent }, //send content, don't care serialize and package.
    { "sendData", sendData }, // send original data, need to serialize and package via proto4z.
    { "kick", kick }, // kick session.
    { "post", _post }, // kick session.

    { NULL, NULL }
};

int luaopen_summer(lua_State *L)
{
    auto founder = std::find_if(_vmCheck.begin(), _vmCheck.end(), [L](lua_State* l){return l == L; });
    if (founder == _vmCheck.end())
    {
        LOGI("registerSummer: L=" << L);
        _vmCheck.push_back(L);
    }
    else
    {
        LOGW("registerSummer warning: L is registered . L=" << L);
    }

    lua_newtable(L);
    for (luaL_Reg *l = summer; l->name != NULL; l++) {
        lua_pushcclosure(L, l->func, 0);  /* closure with those upvalues */
        lua_setfield(L, -2, l->name);
    }
    lua_setglobal(L, "summer");

    return 0;
}

int luaclose_summer(lua_State *L)
{
    auto founder = std::find_if(_vmCheck.begin(), _vmCheck.end(), [L](lua_State* l){return l == L; });
    if (founder != _vmCheck.end())
    {
        LOGI("unregisterSummer: L=" << L);
        _vmCheck.erase(founder);
    }
    else
    {
        LOGW("unregisterSummer warning: L is not found. L=" << L);
    }
    return 0;
}

license_type: permissive

branch_name: refs/heads/master

extension: cpp


text:
package crypto

type CryptoMessage interface {
	Encrypt() (CryptoMessage, error)
	Decrypt() (CryptoMessage, error)
	Bytes() []byte
	SetBytes([]byte)
	String() string
}

license: MIT

repository: leoferlopes/secret

repo_name: leoferlopes/secret

gha_language: Go

extension: go


text:
package main

import (
	"encoding/json"
	"log"
	"net/http"
	"os"
	"os/signal"
	"syscall"
	"time"

	"./user"
)

func main() {
	log.Println("start!")

	//http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
	//	Reply(w, 0, "welcome")
	//})
	http.Handle("/", enforceXMLHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		Reply(w, 0, "welcome")
	})))
	http.Handle("/signrenew", enforceXMLHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		a := user.Account{ID: r.FormValue("uid")}
		a.SignRenew()
		p := struct {
			ID     string
			Token  string
			Name   string
			Avatar string
		}{a.ID, a.Token, "Robert", "/12.png"}
		Reply(w, 0, p)
	})))
	http.Handle("/signout", enforceXMLHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		a := user.Account{ID: r.FormValue("uid")}
		a.Signout()
		Reply(w, 0, "成功退出")
	})))

	http.HandleFunc("/signin", func(w http.ResponseWriter, r *http.Request) {
		log.Println(r)
		var a user.Account
		if ok := a.Signin(r.FormValue("account"), r.FormValue("password")); !ok {
			Reply(w, -1, "账户不存在或账户密码不匹配")
			return
		}
		p := struct {
			ID     string
			Token  string
			Name   string
			Avatar string
		}{a.ID, a.Token, "Robert", "/12.png"}
		Reply(w, 0, p)
	})
	http.HandleFunc("/register", func(w http.ResponseWriter, r *http.Request) {
		var a user.Account
		if ok := a.Register(r.FormValue("account"), r.FormValue("password")); !ok {
			Reply(w, -1, "注册失败, 请检查账号是否正确")
			return
		}
		Reply(w, 0, "注册成功")
	})

	s := &http.Server{
		Addr:           ":80",
		Handler:        http.DefaultServeMux,
		ReadTimeout:    10 * time.Second,
		WriteTimeout:   10 * time.Second,
		MaxHeaderBytes: 1 << 20,
	}

	go func() {
		log.Println(s.ListenAndServe())
		log.Println("server shutdown")
	}()

	ch := make(chan os.Signal)
	signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM)
	log.Println(<-ch)

	log.Println(s.Shutdown(nil))
	time.Sleep(time.Second * 1)

	log.Println("done.")
}

func Reply(w http.ResponseWriter, code int, data interface{}) {
	rep := struct {
		Code int
		Data interface{}
	}{Code: code, Data: data}
	js, err := json.MarshalIndent(rep, "", "\t")
	if err != nil {
		http.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}
	w.Header().Set("Access-Control-Allow-Origin", "*")
	w.Header().Add("Access-Control-Allow-Headers", "Content-Type")
	w.Header().Set("Content-Type", "application/json")
	w.Write(js)
}

func enforceXMLHandler(next http.Handler) http.Handler {
	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		// 通过中间件进行身份验证
		uid, token := r.FormValue("uid"), r.FormValue("token")
		if ok := user.Identity(uid, token); !ok {
			http.Error(w, http.StatusText(400), 400)
			return
		}
		next.ServeHTTP(w, r)
	})
}

repository: InvisibleFuture/cloud

repo_name: InvisibleFuture/cloud


text:
package timeout

import (
	"context"
	"io"
	"net/http"
	"time"

	"github.com/gin-gonic/gin"
)

const (
	defaultTimeout = 3 * time.Second
	defaultCode    = 503
	defaultMsg     = "<title>Timeout</title>
Timeout
"
)

type Option func(*Timeout)

type Timeout struct {
	timeout time.Duration
	code    int
	msg     string
}

func WithTimeout(timeout time.Duration) Option {
	return func(t *Timeout) {
		t.timeout = timeout
	}
}

func WithResponseCode(code int) Option {
	return func(t *Timeout) {
		t.code = code
	}
}

func WithResponseMsg(msg string) Option {
	return func(t *Timeout) {
		t.msg = msg
	}
}

func New(opts ...Option) gin.HandlerFunc {
	t := &Timeout{
		timeout: defaultTimeout,
		code:    defaultCode,
		msg:     defaultMsg,
	}

	for _, opt := range opts {
		opt(t)
	}

	return func(c *gin.Context) {
		ctx, cancelCtx := context.WithTimeout(c.Request.Context(), t.timeout)
		defer cancelCtx()
		c.Request = c.Request.WithContext(ctx)

		tw := &timeoutWriter{
			ResponseWriter: c.Writer,
			h:              make(http.Header),
		}
		c.Writer = tw

		done := make(chan struct{})
		panicChan := make(chan interface{}, 1)

		go func() {
			defer func() {
				if p := recover(); p != nil {
					panicChan <- p
				}
			}()
			c.Next()
			close(done)
		}()

		select {
		case p := <-panicChan:
			panic(p)
		case <-ctx.Done():
			tw.mu.Lock()
			defer tw.mu.Unlock()
			tw.ResponseWriter.WriteHeader(t.code)
			io.WriteString(tw.ResponseWriter, t.msg)
			tw.timedOut = true
			c.Abort()
		case <-done:
			tw.mu.Lock()
			defer tw.mu.Unlock()
			dst := c.Writer.Header()
			for k, vv := range tw.h {
				dst[k] = vv
			}
			if !tw.wroteHeader {
				tw.code = http.StatusOK
			}
			tw.ResponseWriter.WriteHeader(tw.code)
			tw.ResponseWriter.Write(tw.wbuf.Bytes())
		}
	}
}

repository: justlazydog/gin-timeout

repo_name: justlazydog/gin-timeout

branch_name: refs/heads/main


text:
DESCRIPTION = "A Java-based logical analyzer for home use."
LICENSE = "GPL"
HOMEPAGE = "http://sump.org/projects/analyzer/"

PR = "r3"

inherit java

DEPENDS = "rxtx"
RDEPENDS_${PN} = "java2-runtime classpath-awt librxtx-java"

SRC_URI = "\
    http://sump.org/projects/analyzer/downloads/la-src-${PV}.tar.bz2 \
    file://cp-run-fix.patch \
    file://client-makefile.patch \
    file://scrolling-capture-dialog.patch \
    "

S = "${WORKDIR}/LogicAnalyzer"

do_compile() {

  oe_runmake -C client all jar \
    JAR=gjar \
    JAVAH="gjavah -classpath \$(CLASSPATH) -d \$(DEST) -jni" \
    JAVAINCLUDEDIR=${STAGING_INCDIR}/classpath \
    JAVAC="javac -d \$(TOP)/ -O -source 1.3 -target 1.3" \
    JAVAC_FLAGS="-sourcepath . -bootclasspath ${STAGING_DATADIR_NATIVE}/classpath/glibj.zip -classpath ${STAGING_DATADIR}/java/RXTXcomm.jar"

  oe_java_simple_wrapper org.sump.analyzer.Loader analyzer.jar RXTXcomm.jar
}

do_install() {
  oe_jarinstall client/analyzer.jar

  install -d ${D}${bindir}
  install -m 0555 ${PN} ${D}${bindir}
}

PACKAGES = "${PN}"

FILES_${PN} = "${datadir_java}/analyzer.jar ${bindir}/${PN}"

PACKAGE_ARCH = "all"

SRC_URI[md5sum] = "dc8f16011da37ee3114616b96dc80798"
SRC_URI[sha256sum] = "c735f3c0b32f379020a52965e5af45fcd00330b94f94d51603ab5a05b06675fb"

repository: overo/overo-oe-natty

repo_name: overo/overo-oe-natty

branch_name: HEAD

extension: bb


text:
# Arago console image
# gives you an image with basic media libraries

require arago-image.inc

COMPATIBLE_MACHINE = "(?!arago)"

IMAGE_INSTALL += "\
    packagegroup-arago-base \
    packagegroup-arago-console \
    "

export IMAGE_BASENAME = "arago-console-image"


text:
//
// Copyright (c) 2018 CNRS
//
// This file is part of tsid
// tsid is free software: you can redistribute it
// and/or modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation, either version
// 3 of the License, or (at your option) any later version.
// tsid is distributed in the hope that it will be
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Lesser Public License for more details. You should have
// received a copy of the GNU Lesser General Public License along with
// tsid If not, see
// <http://www.gnu.org/licenses/>.
//

#ifndef __tsid_python_task_actuation_bounds_hpp__
#define __tsid_python_task_actuation_bounds_hpp__

#include "tsid/bindings/python/fwd.hpp"

#include "tsid/tasks/task-actuation-bounds.hpp"
#include "tsid/robots/robot-wrapper.hpp"
#include "tsid/math/constraint-inequality.hpp"
#include "tsid/math/constraint-base.hpp"

namespace tsid {
namespace python {
namespace bp = boost::python;

template <typename Task>
struct TaskActuationBoundsPythonVisitor
    : public boost::python::def_visitor<
          TaskActuationBoundsPythonVisitor<Task> > {
  template <class PyClass>

  void visit(PyClass& cl) const {
    cl.def(bp::init<std::string, robots::RobotWrapper&>(
               (bp::arg("name"), bp::arg("robot")), "Default Constructor"))
        .add_property("dim", &Task::dim, "return dimension size")
        .add_property("mask",
                      bp::make_function(
                          &TaskActuationBoundsPythonVisitor::getmask,
                          bp::return_value_policy<bp::copy_const_reference>()),
                      "Return mask")
        .def("setMask", &TaskActuationBoundsPythonVisitor::setmask,
             bp::arg("mask"))
        .def("setBounds", &TaskActuationBoundsPythonVisitor::setBounds,
             bp::args("lower", "upper"))
        .def("compute", &TaskActuationBoundsPythonVisitor::compute,
             bp::args("t", "q", "v", "data"))
        .def("getConstraint", &TaskActuationBoundsPythonVisitor::getConstraint)
        .add_property("getLowerBounds",
                      bp::make_function(
                          &TaskActuationBoundsPythonVisitor::getLowerBounds,
                          bp::return_value_policy<bp::copy_const_reference>()))
        .add_property("getUpperBounds",
                      bp::make_function(
                          &TaskActuationBoundsPythonVisitor::getUpperBounds,
                          bp::return_value_policy<bp::copy_const_reference>()))
        .add_property("name", &TaskActuationBoundsPythonVisitor::name);
  }
  static std::string name(Task& self) {
    std::string name = self.name();
    return name;
  }
  static math::ConstraintInequality compute(Task& self, const double t,
                                            const Eigen::VectorXd& q,
                                            const Eigen::VectorXd& v,
                                            pinocchio::Data& data) {
    self.compute(t, q, v, data);
    math::ConstraintInequality cons(
        self.getConstraint().name(), self.getConstraint().matrix(),
        self.getConstraint().lowerBound(), self.getConstraint().upperBound());
    return cons;
  }
  static math::ConstraintInequality getConstraint(const Task& self) {
    math::ConstraintInequality cons(
        self.getConstraint().name(), self.getConstraint().matrix(),
        self.getConstraint().lowerBound(), self.getConstraint().upperBound());
    return cons;
  }
  static const Eigen::VectorXd& getmask(const Task& self) {
    return self.mask();
  }
  static void setmask(Task& self, const Eigen::VectorXd mask) {
    return self.mask(mask);
  }
  static const Eigen::VectorXd& getLowerBounds(const Task& self) {
    return self.getLowerBounds();
  }
  static const Eigen::VectorXd& getUpperBounds(const Task& self) {
    return self.getUpperBounds();
  }
  static void setBounds(Task& self, const Eigen::VectorXd lower,
                        const Eigen::VectorXd upper) {
    return self.setBounds(lower, upper);
  }
  static void expose(const std::string& class_name) {
    std::string doc = "Task info.";
    bp::class_<Task>(class_name.c_str(), doc.c_str(), bp::no_init)
        .def(TaskActuationBoundsPythonVisitor<Task>());
  }
};
}  // namespace python
}  // namespace tsid

#endif  // ifndef __tsid_python_task_actuation_bounds_hpp__

extension: hpp


text:
DESCRIPTION = "A small, simple, powerful, innovative, web browser for mobile devices"
HOMEPAGE = "http://www.mozilla.org/projects/minimo/"
MAINTAINER = "Rene Wagner <rw@handhelds.org>, Paul Parsons <lost.distance@yahoo.com>"
SECTION = "x11"
PRIORITY = "optional"
LICENSE = "MPL/LGPL/GPL"
EPOCH = "1:"

CVSDATE="20060720"

SRC_URI = "cvs://anonymous@cvs-mirror.mozilla.org/cvsroot;module=mozilla \
	   file://xptcstubs.patch;patch=1 \
	   file://no-x86-asm.patch;patch=1 \
	   file://no-xmb.patch;patch=1 \
	   file://host_ldflags_fix.patch;patch=1 \
	   file://lost-distance.patch;patch=1 \
	   file://minimo-components-ssr-only.patch;patch=1 \
	   file://minimo.png \
	   file://minimo.desktop"
S = "${WORKDIR}/mozilla"

inherit mozilla

EXTRA_OECONF += "--enable-application=minimo --disable-native-uconv"
export MOZ_CO_PROJECT = "minimo"
export MOZ_CO_TAG = "MOZILLA_1_8_BRANCH"

include mozilla-cvs.inc

do_configure() {
	(
		set -e
		for cg in `find ${S} -name config.guess`; do
			install -m 0755 \
			${STAGING_BINDIR}/../share/gnu-config/config.guess \
			${STAGING_BINDIR}/../share/gnu-config/config.sub \
			`dirname $cg`/
		done
	)
	cd ${S}
	oe_runmake -f client.mk CONFIGURE_ARGS="${EXTRA_OECONF}" configure
}

do_compile () {
	oe_runmake -f client.mk build
}

mozdir = "${libdir}/mozilla-minimo"
FILES_${PN} += "${mozdir}"

do_install () {
	./minimo/config/linux_package.sh ${S} ${S}/minimo/config

	mkdir -p ${D}${mozdir}
	cp -rL $MOZ_OBJDIR/dist/minimo/* ${D}${mozdir}/

	mkdir -p ${D}${datadir}/applications
	install -m 0644 ${WORKDIR}/minimo.desktop ${D}${datadir}/applications/

	mkdir -p ${D}${datadir}/pixmaps
	install -m 0644 ${WORKDIR}/minimo.png ${D}${datadir}/pixmaps/

	mkdir -p ${D}${bindir}
	cat > ${D}${bindir}/minimo << EOF
#!/bin/sh
export MOZILLA_FIVE_HOME=${mozdir}
export LD_LIBRARY_PATH=\$MOZILLA_FIVE_HOME
exec \$MOZILLA_FIVE_HOME/minimo "\$@"
EOF
	chmod 755 ${D}${bindir}/minimo
}

repository: Terentyev/familiar-linux

repo_name: Terentyev/familiar-linux


text:
DESCRIPTION = "7-Zip is a file archiver with highest compression ratio."
LICENSE = "lGPL"
LIC_FILES_CHKSUM = "file://DOCS/copying.txt;md5=ecfc54c9e37b63ac58900061ce2eab5a"

PR = "r1"

SRC_URI = " \
        http://sourceforge.net/projects/p7zip/files/p7zip/${PV}/p7zip_${PV}_src_all.tar.bz2 \
	file://makefile.machine \
	file://7z \
"

SRC_URI[md5sum] = "bd6caaea567dc0d995c990c5cc883c89"
SRC_URI[sha256sum] = "49557e7ffca08100f9fc687f4dfc5aea703ca207640c76d9dee7b66f03cb4782"

S = "${WORKDIR}/p7zip_${PV}"

do_compile() {
	cp ${WORKDIR}/makefile.machine ${S}/
	echo CC=${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=\$\(PKG_CONFIG_SYSROOT_DIR\) \$\(ALLFLAGS\) >> ${S}/makefile.machine
	echo CXX=${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=\$\(PKG_CONFIG_SYSROOT_DIR\) \$\(ALLFLAGS\) >> ${S}/makefile.machine
        make -j4 7z
}

do_install() {
        install -d -m 0755 ${D}${bindir}
        install -m 0755 ${WORKDIR}/7z ${D}${bindir}
        install -d -m 0755 ${D}${libdir}/p7zip
        install -m 0755 ${S}/bin/7z  ${D}${libdir}/p7zip/
        install -m 0755 ${S}/bin/7z.so ${D}${libdir}/p7zip/
}

repository: DougBarry/meta-openpandora-vendor

repo_name: DougBarry/meta-openpandora-vendor


text:
<?xml version="1.0" encoding="UTF-8"?>
<drawing version="7">
    <attr value="spartan3e" name="DeviceFamilyName">
        <trait delete="all:0" />
        <trait editname="all:0" />
        <trait edittrait="all:0" />
    </attr>
    <netlist>
        <signal name="XLXN_1" />
        <signal name="XLXN_2" />
        <signal name="XLXN_11" />
        <signal name="O" />
        <signal name="XLXN_15" />
        <signal name="XLXN_16" />
        <signal name="XLXN_18" />
        <signal name="XLXN_19" />
        <signal name="XLXN_20" />
        <signal name="S(3:0)" />
        <signal name="S(2)" />
        <signal name="S(1)" />
        <signal name="S(0)" />
        <signal name="XLXN_37" />
        <signal name="S(3)" />
        <port polarity="Output" name="O" />
        <port polarity="Input" name="S(3:0)" />
        <blockdef name="m8_1e">
            <timestamp>2000-1-1T10:10:10</timestamp>
            <line x2="96" y1="-224" y2="-224" x1="0" />
            <line x2="96" y1="-160" y2="-160" x1="0" />
            <line x2="96" y1="-96" y2="-96" x1="0" />
            <line x2="96" y1="-288" y2="-288" x1="0" />
            <line x2="96" y1="-352" y2="-352" x1="0" />
            <line x2="96" y1="-416" y2="-416" x1="0" />
            <line x2="96" y1="-544" y2="-544" x1="0" />
            <line x2="96" y1="-608" y2="-608" x1="0" />
            <line x2="96" y1="-672" y2="-672" x1="0" />
            <line x2="96" y1="-736" y2="-736" x1="0" />
            <line x2="96" y1="-160" y2="-160" x1="160" />
            <line x2="160" y1="-268" y2="-160" x1="160" />
            <line x2="96" y1="-224" y2="-224" x1="128" />
            <line x2="128" y1="-264" y2="-224" x1="128" />
            <line x2="96" y1="-96" y2="-96" x1="192" />
            <line x2="192" y1="-276" y2="-96" x1="192" />
            <line x2="96" y1="-32" y2="-32" x1="224" />
            <line x2="224" y1="-280" y2="-32" x1="224" />
            <line x2="256" y1="-512" y2="-512" x1="320" />
            <line x2="96" y1="-768" y2="-256" x1="96" />
            <line x2="96" y1="-704" y2="-768" x1="256" />
            <line x2="256" y1="-288" y2="-704" x1="256" />
            <line x2="256" y1="-256" y2="-288" x1="96" />
            <line x2="96" y1="-32" y2="-32" x1="0" />
            <line x2="96" y1="-480" y2="-480" x1="0" />
        </blockdef>
        <blockdef name="or2">
            <timestamp>2000-1-1T10:10:10</timestamp>
            <line x2="64" y1="-64" y2="-64" x1="0" />
            <line x2="64" y1="-128" y2="-128" x1="0" />
            <line x2="192" y1="-96" y2="-96" x1="256" />
            <arc ex="192" ey="-96" sx="112" sy="-48" r="88" cx="116" cy="-136" />
            <arc ex="48" ey="-144" sx="48" sy="-48" r="56" cx="16" cy="-96" />
            <line x2="48" y1="-144" y2="-144" x1="112" />
            <arc ex="112" ey="-144" sx="192" sy="-96" r="88" cx="116" cy="-56" />
            <line x2="48" y1="-48" y2="-48" x1="112" />
        </blockdef>
        <blockdef name="inv">
            <timestamp>2000-1-1T10:10:10</timestamp>
            <line x2="64" y1="-32" y2="-32" x1="0" />
            <line x2="160" y1="-32" y2="-32" x1="224" />
            <line x2="128" y1="-64" y2="-32" x1="64" />
            <line x2="64" y1="-32" y2="0" x1="128" />
            <line x2="64" y1="0" y2="-64" x1="64" />
            <circle r="16" cx="144" cy="-32" />
        </blockdef>
        <blockdef name="gnd">
            <timestamp>2000-1-1T10:10:10</timestamp>
            <line x2="64" y1="-64" y2="-96" x1="64" />
            <line x2="52" y1="-48" y2="-48" x1="76" />
            <line x2="60" y1="-32" y2="-32" x1="68" />
            <line x2="40" y1="-64" y2="-64" x1="88" />
            <line x2="64" y1="-64" y2="-80" x1="64" />
            <line x2="64" y1="-128" y2="-96" x1="64" />
        </blockdef>
        <blockdef name="vcc">
            <timestamp>2000-1-1T10:10:10</timestamp>
            <line x2="64" y1="-32" y2="-64" x1="64" />
            <line x2="64" y1="0" y2="-32" x1="64" />
            <line x2="32" y1="-64" y2="-64" x1="96" />
        </blockdef>
        <block symbolname="m8_1e" name="XLXI_1">
            <blockpin signalname="XLXN_16" name="D0" />
            <blockpin signalname="XLXN_16" name="D1" />
            <blockpin signalname="XLXN_16" name="D2" />
            <blockpin signalname="XLXN_15" name="D3" />
            <blockpin signalname="XLXN_16" name="D4" />
            <blockpin signalname="XLXN_16" name="D5" />
            <blockpin signalname="XLXN_16" name="D6" />
            <blockpin signalname="XLXN_15" name="D7" />
            <blockpin signalname="XLXN_37" name="E" />
            <blockpin signalname="S(0)" name="S0" />
            <blockpin signalname="S(1)" name="S1" />
            <blockpin signalname="S(2)" name="S2" />
            <blockpin signalname="XLXN_1" name="O" />
        </block>
        <block symbolname="m8_1e" name="XLXI_2">
            <blockpin signalname="XLXN_16" name="D0" />
            <blockpin signalname="XLXN_16" name="D1" />
            <blockpin signalname="XLXN_16" name="D2" />
            <blockpin signalname="XLXN_15" name="D3" />
            <blockpin signalname="XLXN_16" name="D4" />
            <blockpin signalname="XLXN_15" name="D5" />
            <blockpin signalname="XLXN_16" name="D6" />
            <blockpin signalname="XLXN_15" name="D7" />
            <blockpin signalname="S(3)" name="E" />
            <blockpin signalname="S(0)" name="S0" />
            <blockpin signalname="S(1)" name="S1" />
            <blockpin signalname="S(2)" name="S2" />
            <blockpin signalname="XLXN_2" name="O" />
        </block>
        <block symbolname="or2" name="XLXI_3">
            <blockpin signalname="XLXN_2" name="I0" />
            <blockpin signalname="XLXN_1" name="I1" />
            <blockpin signalname="O" name="O" />
        </block>
        <block symbolname="gnd" name="XLXI_5">
            <blockpin signalname="XLXN_16" name="G" />
        </block>
        <block symbolname="vcc" name="XLXI_6">
            <blockpin signalname="XLXN_15" name="P" />
        </block>
        <block symbolname="inv" name="XLXI_11">
            <blockpin signalname="S(3)" name="I" />
            <blockpin signalname="XLXN_37" name="O" />
        </block>
    </netlist>
    <sheet sheetnum="1" width="3520" height="2720">
        <instance x="1136" y="1024" name="XLXI_1" orien="R0" />
        <instance x="1136" y="1840" name="XLXI_2" orien="R0" />
        <instance x="1520" y="1056" name="XLXI_3" orien="R0" />
        <branch name="XLXN_1">
            <wire x2="1488" y1="512" y2="512" x1="1456" />
            <wire x2="1488" y1="512" y2="928" x1="1488" />
            <wire x2="1520" y1="928" y2="928" x1="1488" />
        </branch>
        <branch name="XLXN_2">
            <wire x2="1488" y1="1328" y2="1328" x1="1456" />
            <wire x2="1488" y1="992" y2="1328" x1="1488" />
            <wire x2="1504" y1="992" y2="992" x1="1488" />
            <wire x2="1520" y1="992" y2="992" x1="1504" />
        </branch>
        <branch name="O">
            <wire x2="1808" y1="960" y2="960" x1="1776" />
        </branch>
        <iomarker fontsize="28" x="1808" y="960" name="O" orien="R0" />
        <instance x="1024" y="1984" name="XLXI_5" orien="R0" />
        <instance x="992" y="240" name="XLXI_6" orien="R0" />
        <branch name="XLXN_15">
            <wire x2="1056" y1="240" y2="480" x1="1056" />
            <wire x2="1136" y1="480" y2="480" x1="1056" />
            <wire x2="1056" y1="480" y2="736" x1="1056" />
            <wire x2="1056" y1="736" y2="1296" x1="1056" />
            <wire x2="1056" y1="1296" y2="1424" x1="1056" />
            <wire x2="1056" y1="1424" y2="1552" x1="1056" />
            <wire x2="1136" y1="1552" y2="1552" x1="1056" />
            <wire x2="1136" y1="1424" y2="1424" x1="1056" />
            <wire x2="1136" y1="1296" y2="1296" x1="1056" />
            <wire x2="1136" y1="736" y2="736" x1="1056" />
        </branch>
        <branch name="XLXN_16">
            <wire x2="1136" y1="288" y2="288" x1="1088" />
            <wire x2="1088" y1="288" y2="352" x1="1088" />
            <wire x2="1136" y1="352" y2="352" x1="1088" />
            <wire x2="1088" y1="352" y2="416" x1="1088" />
            <wire x2="1136" y1="416" y2="416" x1="1088" />
            <wire x2="1088" y1="416" y2="544" x1="1088" />
            <wire x2="1136" y1="544" y2="544" x1="1088" />
            <wire x2="1088" y1="544" y2="608" x1="1088" />
            <wire x2="1136" y1="608" y2="608" x1="1088" />
            <wire x2="1088" y1="608" y2="672" x1="1088" />
            <wire x2="1136" y1="672" y2="672" x1="1088" />
            <wire x2="1088" y1="672" y2="800" x1="1088" />
            <wire x2="1088" y1="800" y2="864" x1="1088" />
            <wire x2="1088" y1="864" y2="928" x1="1088" />
            <wire x2="1088" y1="928" y2="1104" x1="1088" />
            <wire x2="1136" y1="1104" y2="1104" x1="1088" />
            <wire x2="1088" y1="1104" y2="1168" x1="1088" />
            <wire x2="1136" y1="1168" y2="1168" x1="1088" />
            <wire x2="1088" y1="1168" y2="1232" x1="1088" />
            <wire x2="1136" y1="1232" y2="1232" x1="1088" />
            <wire x2="1088" y1="1232" y2="1360" x1="1088" />
            <wire x2="1136" y1="1360" y2="1360" x1="1088" />
            <wire x2="1088" y1="1360" y2="1488" x1="1088" />
            <wire x2="1088" y1="1488" y2="1856" x1="1088" />
            <wire x2="1136" y1="1488" y2="1488" x1="1088" />
        </branch>
        <branch name="S(3:0)">
            <wire x2="720" y1="736" y2="736" x1="688" />
            <wire x2="720" y1="736" y2="768" x1="720" />
            <wire x2="720" y1="768" y2="800" x1="720" />
            <wire x2="720" y1="800" y2="864" x1="720" />
            <wire x2="720" y1="864" y2="928" x1="720" />
            <wire x2="720" y1="928" y2="992" x1="720" />
            <wire x2="720" y1="992" y2="1616" x1="720" />
            <wire x2="720" y1="1616" y2="1680" x1="720" />
            <wire x2="720" y1="1680" y2="1744" x1="720" />
            <wire x2="720" y1="1744" y2="1808" x1="720" />
            <wire x2="720" y1="1808" y2="1856" x1="720" />
        </branch>
        <iomarker fontsize="28" x="688" y="736" name="S(3:0)" orien="R180" />
        <bustap x2="816" y1="928" y2="928" x1="720" />
        <branch name="S(2)">
            <attrtext style="alignment:SOFT-BCENTER;fontsize:28;fontname:Arial" attrname="Name" x="976" y="928" type="branch" />
            <wire x2="976" y1="928" y2="928" x1="816" />
            <wire x2="1136" y1="928" y2="928" x1="976" />
        </branch>
        <bustap x2="816" y1="864" y2="864" x1="720" />
        <branch name="S(1)">
            <attrtext style="alignment:SOFT-BCENTER;fontsize:28;fontname:Arial" attrname="Name" x="976" y="864" type="branch" />
            <wire x2="976" y1="864" y2="864" x1="816" />
            <wire x2="1136" y1="864" y2="864" x1="976" />
        </branch>
        <bustap x2="816" y1="800" y2="800" x1="720" />
        <branch name="S(0)">
            <attrtext style="alignment:SOFT-BCENTER;fontsize:28;fontname:Arial" attrname="Name" x="976" y="800" type="branch" />
            <wire x2="976" y1="800" y2="800" x1="816" />
            <wire x2="1136" y1="800" y2="800" x1="976" />
        </branch>
        <bustap x2="816" y1="1744" y2="1744" x1="720" />
        <branch name="S(2)">
            <attrtext style="alignment:SOFT-BCENTER;fontsize:28;fontname:Arial" attrname="Name" x="848" y="1744" type="branch" />
            <wire x2="848" y1="1744" y2="1744" x1="816" />
            <wire x2="880" y1="1744" y2="1744" x1="848" />
            <wire x2="1104" y1="1744" y2="1744" x1="880" />
            <wire x2="1120" y1="1744" y2="1744" x1="1104" />
            <wire x2="1136" y1="1744" y2="1744" x1="1120" />
        </branch>
        <bustap x2="816" y1="1680" y2="1680" x1="720" />
        <branch name="S(1)">
            <attrtext style="alignment:SOFT-BCENTER;fontsize:28;fontname:Arial" attrname="Name" x="848" y="1680" type="branch" />
            <wire x2="848" y1="1680" y2="1680" x1="816" />
            <wire x2="880" y1="1680" y2="1680" x1="848" />
            <wire x2="1104" y1="1680" y2="1680" x1="880" />
            <wire x2="1120" y1="1680" y2="1680" x1="1104" />
            <wire x2="1136" y1="1680" y2="1680" x1="1120" />
        </branch>
        <bustap x2="816" y1="1616" y2="1616" x1="720" />
        <branch name="S(0)">
            <attrtext style="alignment:SOFT-BCENTER;fontsize:28;fontname:Arial" attrname="Name" x="848" y="1616" type="branch" />
            <wire x2="848" y1="1616" y2="1616" x1="816" />
            <wire x2="880" y1="1616" y2="1616" x1="848" />
            <wire x2="1104" y1="1616" y2="1616" x1="880" />
            <wire x2="1120" y1="1616" y2="1616" x1="1104" />
            <wire x2="1136" y1="1616" y2="1616" x1="1120" />
        </branch>
        <branch name="XLXN_37">
            <wire x2="1136" y1="992" y2="992" x1="1104" />
        </branch>
        <bustap x2="816" y1="1808" y2="1808" x1="720" />
        <branch name="S(3)">
            <attrtext style="alignment:SOFT-BCENTER;fontsize:28;fontname:Arial" attrname="Name" x="976" y="1808" type="branch" />
            <wire x2="976" y1="1808" y2="1808" x1="816" />
            <wire x2="1136" y1="1808" y2="1808" x1="976" />
        </branch>
        <instance x="880" y="1024" name="XLXI_11" orien="R0" />
        <bustap x2="816" y1="992" y2="992" x1="720" />
        <branch name="S(3)">
            <attrtext style="alignment:SOFT-BCENTER;fontsize:28;fontname:Arial" attrname="Name" x="848" y="992" type="branch" />
            <wire x2="848" y1="992" y2="992" x1="816" />
            <wire x2="880" y1="992" y2="992" x1="848" />
        </branch>
    </sheet>
</drawing>

license: Unlicense

repository: justin-vanwinkle/Coursework

repo_name: justin-vanwinkle/Coursework

extension: sch