admin
2022-09-30 1a16b19acb23a4f28bafd01f3ed80fb225a96c3e
'bug修复'
25个文件已修改
20个文件已添加
1637 ■■■■■ 已修改文件
ConsoleApplication/CaptureUtil.cpp 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ConsoleApplication/CurrentPriceCapture.cpp 82 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ConsoleApplication/CurrentPriceCapture.h 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ConsoleApplication/L2DataCapture.cpp 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ConsoleApplication/L2DataCapture.h 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ConsoleApplication/LimitUpCapture.cpp 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ConsoleApplication/OpenCLExcuter.cpp 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ConsoleApplication/THSActionUtil.cpp 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ConsoleApplication/THSActionUtil.h 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ConsoleApplication/THSGPDataCapture.cpp 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ConsoleApplication/Win32Util.cpp 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ConsoleApplication/Win32Util.h 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ConsoleApplication/kernel.cl 92 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ConsoleApplication/main.cpp 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/ExcelUtil.cpp 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/ExcelUtil.h 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/JsonUtil.h 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/app.aps 补丁 | 查看 | 原始文档 | blame | 历史
app/app.rc 补丁 | 查看 | 原始文档 | blame | 历史
app/app.vcxproj 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/app.vcxproj.user 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/appDlg.cpp 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/appDlg.h 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/libxls.dll 补丁 | 查看 | 原始文档 | blame | 历史
app/libxls.lib 补丁 | 查看 | 原始文档 | blame | 历史
app/libxls/bin/xls2csv.exe 补丁 | 查看 | 原始文档 | blame | 历史
app/libxls/include/libxls/brdb.c.h 208 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/libxls/include/libxls/brdb.h 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/libxls/include/libxls/ole.h 173 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/libxls/include/libxls/xlsstruct.h 478 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/libxls/include/libxls/xlstool.h 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/libxls/include/libxls/xlstypes.h 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/libxls/include/xls.h 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/libxls/lib/endian.o 补丁 | 查看 | 原始文档 | blame | 历史
app/libxls/lib/libxls.def 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/libxls/lib/libxls.dll 补丁 | 查看 | 原始文档 | blame | 历史
app/libxls/lib/libxls.exp 补丁 | 查看 | 原始文档 | blame | 历史
app/libxls/lib/libxls.lib 补丁 | 查看 | 原始文档 | blame | 历史
app/libxls/lib/libxlsreader.a 补丁 | 查看 | 原始文档 | blame | 历史
app/libxls/lib/libxlsreader.la 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/libxls/lib/ole.o 补丁 | 查看 | 原始文档 | blame | 历史
app/libxls/lib/xls.o 补丁 | 查看 | 原始文档 | blame | 历史
app/libxls/lib/xlstool.o 补丁 | 查看 | 原始文档 | blame | 历史
app/resource.h 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/user.txt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ConsoleApplication/CaptureUtil.cpp
@@ -120,6 +120,6 @@
cv::Mat  CaptureUtil::capture(HWND hwnd) {
    clock_t starttime = clock();
    cv::Mat cap = _wss::screen_shot_by_window(hwnd);
    std::cout << "截图耗时: threadid-" << std::this_thread::get_id() << " 耗时:" << clock() - starttime << endl;
    //std::cout << "截图耗时: threadid-" << std::this_thread::get_id() << " 耗时:" << clock() - starttime << endl;
    return cap;
}
ConsoleApplication/CurrentPriceCapture.cpp
@@ -32,7 +32,7 @@
        if (kill)
            break;
        if (tradeTimeCapture) {
            if (!GPUtil::isPreTradeTime()) {
            if (!GPUtil::isTradeTime()) {
                Sleep(100);
                continue;
            }
@@ -72,7 +72,12 @@
    thread rt(&(CurrentPriceCapture::_run));
    rt.detach();
    inited = true;
    try {
    refreshHWND();
    }
    catch (string st) {
    }
}
void CurrentPriceCapture::reCreateRunning()
{
@@ -124,7 +129,8 @@
    list<int*> rowData = THSActionUtil::splitPlateRowArea(grayImg);
    //每行的元素个数
    int ele_count_per_line = 2;
    int ele_count_per_line = 3;
    int length_per_num = 6;
    int* splitResult = (int*)malloc(sizeof(int) * 4 * 4 * rowData.size());
    int* rowIndex = (int*)malloc(sizeof(int) * 4 * rowData.size());
    int count = 0;
@@ -141,9 +147,9 @@
        count++;
    }
    int line_number_count = ele_count_per_line * 6;
    int line_number_count = ele_count_per_line * length_per_num;
    openCLExcuter->splitPlateContentRowData(grayImg.data, grayImg.cols, grayImg.rows, rowIndex, rowData.size(), ele_count_per_line,1,2,splitResult);
    openCLExcuter->splitPlateContentRowData(grayImg.data, grayImg.cols, grayImg.rows, rowIndex, rowData.size(), ele_count_per_line,1,3,splitResult);
    /*
    *测试
@@ -183,10 +189,9 @@
    UcharDataInfo typesData = UcharDataInfo();
    unsigned char types[] = { NUM_TYPE_CODE, NUM_TYPE_PRICE };
    typesData.length = 2;
    unsigned char types[] = { NUM_TYPE_MONEY, NUM_TYPE_CODE, NUM_TYPE_PRICE };
    typesData.length = 3;
    typesData.data = types;
    int length_per_num = 6;
    openCLExcuter->splitPlateNum(grayImg, IntDataInfo({ splitResult,(int)(ele_count_per_line * rowData.size()) }), UcharDataInfo({ totalNumberData, -1 }), typesData, zeroData, _NUMBER_GP_CODE_WIDTH, _NUMBER_GP_CODE_HEIGHT, ele_count_per_line, length_per_num);
@@ -200,24 +205,34 @@
    list<CurrentPriceData> dataList;
    for (int i = 0;i < rowData.size();i++) {
        CurrentPriceData currentData = CurrentPriceData();
        string code = "";
        for (int j = 0;j < 6;j++)
        string volumn = "";
        for (int j = 0;j < length_per_num;j++)
        {
            code.append(to_string(numberResult[i][j]));
            if (j == 4) {
                volumn.append(".");
            }
            volumn.append(to_string(numberResult[i][length_per_num * 0 + j]));
        }
        string code = "";
        for (int j = 0;j < length_per_num;j++)
        {
            code.append(to_string(numberResult[i][length_per_num * 1 + j]));
        }
        string price = "";
        for (int j = 0;j < 6;j++)
        for (int j = 0;j < length_per_num;j++)
        {
            if (j == 4) {
                price.append(".");
            }
            price.append(to_string(numberResult[i][6 * 1 + j]));
            price.append(to_string(numberResult[i][length_per_num * 2 + j]));
        }
        currentData.index = i;
        currentData.code = code;
        currentData.volumn = volumn;
        currentData.price = price;
        if ( currentData.price != "0000.00") {
            dataList.push_back(currentData);
@@ -226,12 +241,53 @@
    }
    free(numberResult);
    int* unitData = (int*)malloc(sizeof(int) * 4 * dataList.size());
    //获取量的单位
    int index = 0;
    for (list<CurrentPriceData>::iterator ele = dataList.begin();ele != dataList.end();ele++) {
        unitData[index * 4 + 0] = splitResult[(*ele).index * 4 * ele_count_per_line + 4 * 0 + 0];
        unitData[index * 4 + 1] = splitResult[(*ele).index * 4 * ele_count_per_line + 4 * 0 + 1];
        unitData[index * 4 + 2] = splitResult[(*ele).index * 4 * ele_count_per_line + 4 * 0 + 2];
        unitData[index * 4 + 3] = splitResult[(*ele).index * 4 * ele_count_per_line + 4 * 0 + 3];
        index++;
    }
    int* unitResult = (int*)malloc(sizeof(int) * dataList.size());
    openCLExcuter->recognitionPlateMoneyUnit(grayImg.data, grayImg.cols, grayImg.rows, unitData, 1, dataList.size(), unitResult);
    index = 0;
    for (list<CurrentPriceData>::iterator ele = dataList.begin();ele != dataList.end();ele++) {
        switch (unitResult[index])
        {
        case 0:
            (*ele).volumnUnit = MONEY_UNIT_Y;
            break;
        case 1:
            (*ele).volumnUnit = MONEY_UNIT_W;
            break;
        case 2:
            (*ele).volumnUnit = MONEY_UNIT_NO;
            (*ele).volumn = to_string((int)round( stof((*ele).volumn) * 100));
        default:
            break;
        }
        //cout<< (*ele).code<<" "<< (*ele).price <<" "<< (*ele).volumn;
        //if ((*ele).volumnUnit == MONEY_UNIT_Y) {
        //    cout <<"亿"<<endl;
        //}else if ((*ele).volumnUnit == MONEY_UNIT_W) {
        //    cout << "万" << endl;
        //}
        //else {
        //    cout << "" << endl;
        //}
        index++;
    }
    free(rowIndex);
    free(splitResult);
    free(zeroData);
    free(templateNums);
    free(unitData);
    free(unitResult);
    free(imgData);
    grayImg.release();
ConsoleApplication/CurrentPriceCapture.h
@@ -10,6 +10,8 @@
{
    string code;
    string price;
    string volumn;
    MoneyUnit volumnUnit;
    //辅助功能
    int index;
};
ConsoleApplication/L2DataCapture.cpp
@@ -48,9 +48,11 @@
            string code = gpCodes[index];
            try {
                clock_t start = clock();
                list<TradeData> resultList = captureLevel2TradeData(CaptureUtil::capture(index, CAPTURE_TYPE_L2), index);
                data_callback(index, code, resultList, context);
                cout << "时间消耗:" << clock() - start << endl;
                cv::Mat mat = CaptureUtil::capture(index, CAPTURE_TYPE_L2);
                list<TradeData> resultList = captureLevel2TradeData(mat, index);
                long processTime = clock() - start;
                data_callback(index, code, start , processTime, resultList, context);
                cout << "时间消耗:" << processTime << endl;
            }
            catch (...) {
@@ -80,11 +82,9 @@
}
void L2DataCapture::setGPCode(int index, string code) {
    int length = sizeof(gpCodes) / sizeof(gpCodes[0]);
    if (length <= index) {
    if (THS_FRAME_COUNT <= index) {
        return;
    }
    gpCodes[index] = code;
}
@@ -198,7 +198,7 @@
    list<TradeData> resultList=  captureLevel2TradeData(openCLExcuter[identify], oimg, identify);
    std::cout << "-------L2行情识别结束任务: threadid-" << std::this_thread::get_id() << "  序号:" << identify << " 耗时:" << clock() - starttime  <<"  数据量:"<< resultList.size() << endl;
    std::cout << "-------L2行情识别结束任务: threadid-" << std::this_thread::get_id() << "  序号:" << identify << " CODE:"<< gpCodes[identify] << " 耗时:" << clock() - starttime  <<"  数据量:"<< resultList.size() << endl;
    return resultList;
}
ConsoleApplication/L2DataCapture.h
@@ -8,7 +8,7 @@
#include "BaseCapture.h"
#define THS_FRAME_COUNT 8
typedef void (*CallbackFun)(int index, string code, list<TradeData> dataList, void* contex);
typedef void (*CallbackFun)(int index, string code,long captureTime,long processTime, list<TradeData> dataList, void* contex);
typedef void (*CallbackFun_Trade_Queue)(int index, string code, list<int> numList, void* contex);
ConsoleApplication/LimitUpCapture.cpp
@@ -246,8 +246,8 @@
            path.append(to_string(i)).append("_").append(to_string(j)).append(".jpg");
            //cv::imwrite(path, cv::Mat(grayImg, cv::Rect(sx, sy, ex - sx + 1, ey - sy + 1)));
        }
        int sx = splitResult[(ele_count_per_line * i + 0) * 4 + 0];
        int ex = splitResult[(ele_count_per_line * i + 0) * 4 + 2];
        int sx = splitResult[(ele_count_per_line * i + 1) * 4 + 0];
        int ex = splitResult[(ele_count_per_line * i + 1) * 4 + 2];
        if (ex - sx < 40) {
        //噪点数据
            excudeIndexs.insert(i);
@@ -338,6 +338,7 @@
            }
            percent.append(to_string(numberResult[i][num_length_per_ele * 4 + j]));
        }
        /*
        if (percent == "0000.00") {
            int sx = splitResult[(ele_count_per_line * i + 4) * 4 + 0];
            int sy = splitResult[(ele_count_per_line * i + 4) * 4 + 1];
@@ -347,6 +348,7 @@
            path.append(to_string(i)).append("_").append(".jpg");
            cv::imwrite(path, cv::Mat(grayImg, cv::Rect(sx, sy, ex - sx + 1, ey - sy + 1)));
        }
        */
        limitUpData.index = i;
        limitUpData.code = code;
@@ -449,6 +451,7 @@
            PostMessage(win, WM_MOUSEWHEEL, 0, MAKEWORD(x, y));
            Sleep(200);
            cv::Mat oimg = CaptureUtil::capture(win);
            try {
            list<LimitUpData> codes = captureLimitUpCodes(oimg);
            for (list<LimitUpData>::iterator ele = codes.begin();ele != codes.end();ele++) {
                string code = (*ele).code;
@@ -458,6 +461,11 @@
                }
            }
            codes.clear();
            }
            catch (string e) {
                cout << e << endl;
            }
            Sleep(50);
        }
    }
ConsoleApplication/OpenCLExcuter.cpp
@@ -384,6 +384,12 @@
    error = clEnqueueReadBuffer(queue, memObject4, CL_TRUE, 0, resultSize * sizeof(unsigned char),
        result.data, 0, NULL, NULL);
    if (error != CL_SUCCESS) {
        clReleaseKernel(kernel);
        clReleaseMemObject(memObject1);
        clReleaseMemObject(memObject2);
        clReleaseMemObject(memObject3);
        clReleaseMemObject(memObject4);
        clReleaseMemObject(memObject5);
        throw string("Error reading result buffer!\n");
    }
ConsoleApplication/THSActionUtil.cpp
@@ -541,6 +541,7 @@
    std::list<int*> dataItemList;
    for (int i = start_row;i < end_row;i++) {
        //TODO  100
        bool empty = ImgDivider::isRowEmpty(img, i, start_col, start_col + 50, 1, _IMG_BINARY_THRESHOLD) && ImgDivider::isRowEmpty(img, i, start_col + 50, start_col + 150, 2, _IMG_BINARY_THRESHOLD) && ImgDivider::isRowEmpty(img, i, start_col + (end_col - start_col) / 2 - 40, start_col + (end_col - start_col) / 2 + 40, 1, _IMG_BINARY_THRESHOLD);
        if (empty) {
            if (emptyStartRow < 0) {
@@ -1457,6 +1458,67 @@
    return FALSE;
}
void THSActionUtil::updateMainSite()
{
    //获取主页
    HWND main = getMainWin();
    if (main <= 0) {
        throw string("同花顺主页未打开");
    }
    Win32Util::showWindow(main);
    //获取toolbar
    HWND win = NULL;
    do {
        win = FindWindowExA(main, win, "AfxControlBar100s", "");
        if (win <= 0) {
            break;
        }
        RECT rect;
        GetWindowRect(win, &rect);
        if (rect.bottom - rect.top >= 40 && rect.bottom - rect.top <= 60) {
            break;
        }
    } while (true);
    if (win <= 0) {
        throw string("测速按钮未找到");
    }
    win = FindWindowExA(win, NULL, "#32770", "");
    if (win <= 0) {
        throw string("测速按钮未找到");
    }
    HWND btn = GetDlgItem(win, 0x00007A17);
    if (btn <= 0) {
        throw string("测速按钮未找到");
    }
    //点击按钮
    Win32Util::visualClick(btn, MAKELONG(3,3));
    for (int i = 0;i < 10;i++) {
        list<HWND> _list = Win32Util::searchWindow("选择最优行情主站");
        if (_list.size() > 0) {
            HWND win = *(_list.begin());
            HWND loginBtn = 0;
            for (int j = 0;j < 10;j++)
            {
                loginBtn =    FindWindowExA(win, NULL, "Button", "登 录");
                if (loginBtn > 0) {
                    //点击登录按钮
                    Win32Util::visualClick(loginBtn, MAKELONG(2, 2));
                    break;
                }
                Sleep(200);
            }
        }
        Sleep(400);
    }
}
void THSActionUtil::clearPlateCodes(HWND hwnd)
{
    HWND content = FindWindowExA(hwnd, NULL, "AfxFrameOrView100s", NULL);
ConsoleApplication/THSActionUtil.h
@@ -17,6 +17,7 @@
enum MoneyUnit {
    MONEY_UNIT_Y,
    MONEY_UNIT_W,
    MONEY_UNIT_NO,
};
struct GPCodeArea
{
@@ -108,5 +109,8 @@
    //同花顺是否卡死
    static bool thsIsDead();
    //更新行情主站
    static void updateMainSite();
};
ConsoleApplication/THSGPDataCapture.cpp
@@ -32,7 +32,6 @@
list<list<GPDataStruct>> THSGPDataCapture::captureGPData(cv::Mat grayImg, SplitType types[], int length_per_num, int startColumn, int endColumn) {
    list<int*> rowData = THSActionUtil::splitPlateRowArea(grayImg);
    int count = 0;
    int* rowIndex = (int*)malloc(sizeof(int) * 4 * rowData.size());
ConsoleApplication/Win32Util.cpp
@@ -246,5 +246,11 @@
    GetWindowRect(hwnd, rect);
}
void Win32Util::visualClick(HWND hwnd, LPARAM pos)
{
    PostMessage(hwnd, WM_LBUTTONDOWN, 0x00000001, pos);
    PostMessage(hwnd, WM_LBUTTONUP, 0x00000000, pos);
}
ConsoleApplication/Win32Util.h
@@ -55,5 +55,8 @@
    //获取位置
    static void getWindowRect(HWND hwnd,RECT *rect);
    //虚拟点击
    static void visualClick(HWND hwnd, LPARAM pos);
};
ConsoleApplication/kernel.cl
@@ -116,6 +116,8 @@
    //只能识别4种数字
    unsigned char type = types[index % ele_count_per_line];
    //printf("ele_count_line:%d\n", ele_count_line);
        //是否只有一位小数
    bool one_point_num = false;
    //时间
    if (type == 0) {
        //时间
@@ -220,6 +222,28 @@
        //查找单位前的空格
        int num_end = -1;
        int i;
        //获取是否有单位
        int last_empty_index = -1;
        for (i = endx;i >= startx;i--) {
            bool empty = 1;
            for (int y = starty;y < endy;y++) {
                if (get_binary_value(img_in[get_one_level_position(width, i, y)]) > 0) {
                    empty = 0;
                    break;
                }
            }
            if (empty) {
                last_empty_index = i;
                break;
            }
        }
        bool hasUnit = false;
        if (endx - last_empty_index > num_width) {
            hasUnit = true;
        }
        //带有单位
        if (hasUnit) {
        for (i = endx - 11;i >= startx;i--) {
            bool empty = 1;
            for (int y = starty;y < endy;y++) {
@@ -231,6 +255,7 @@
            if (empty) {
                num_end = i - 1;
                break;
                }
            }
        }
@@ -327,10 +352,19 @@
        if (m_s == -1 || m_e == -1) {
            //printf("没找到小数点:%d", index);
            if (hasUnit)
            {
            nps[0] = -1;
            nps[1] = -1;
            nps[2] = -1;
            nps[3] = -1;
            }
            else {
                nps[0] = startx;
                nps[1] = starty;
                nps[2] = endx;
                nps[3] = endy;
            }
            nps[4] = -1;
            nps[5] = -1;
@@ -350,6 +384,9 @@
            nps[5] = starty;
            nps[6] = num_end;
            nps[7] = endy;
            if (nps[6] - nps[4] + 1 <= num_width) {
                one_point_num = true;
            }
        }
        nps[8] = -1;
@@ -469,7 +506,8 @@
            }
            if (empty) {
                emptyIndex = i;
            }else if (emptyIndex > 0) {
            }
            else if (emptyIndex > 0) {
                percent_start = i;
                break;
            }
@@ -491,7 +529,8 @@
            }
            if (empty) {
                emptyIndex = i;
            }else if (emptyIndex > 0) {
            }
            else if (emptyIndex > 0) {
                percent_end = i;
                break;
            }
@@ -636,7 +675,7 @@
        }
    }
    int zeroCount = length_per_num - numCount;
    int zeroCount = length_per_num - numCount - (one_point_num?1:0);
    //最大为20位数
    int fresult[20 * 2];
    for (i = 0;i < zeroCount;i++) {
@@ -647,6 +686,11 @@
    for (i = 0;i < numCount;i++) {
        fresult[(i + zeroCount) * 2] = numberCols[i * 2];
        fresult[(i + zeroCount) * 2 + 1] = numberCols[i * 2 + 1];
    }
    //一位小数需要在末尾填充0
    if (type == 1 && one_point_num) {
        fresult[(numCount + zeroCount) * 2] = -1;
        fresult[(numCount + zeroCount) * 2 + 1] = -1;
    }
    //开始填充数据
@@ -776,7 +820,10 @@
    //只能识别4种数字
    unsigned char type = types[index % ele_count_per_line];
    //printf("ele_count_line:%d\n", ele_count_line);
    //是否只有一位小数
    bool one_point_num = false;
    //时间
    if (type == 0) {
        //时间
        int s = cols / 2;
@@ -998,6 +1045,10 @@
            nps[5] = starty;
            nps[6] = num_end;
            nps[7] = endy;
            if (nps[6] - nps[4] <= num_width) {
             //只有一个数字
                one_point_num = true;
            }
        }
@@ -1160,7 +1211,7 @@
        }
    }
    int zeroCount = length_per_num - numCount;
    int zeroCount = length_per_num - numCount - (one_point_num?1:0);
    //最大为20位数
    int fresult[20 * 2];
    for (i = 0;i < zeroCount;i++) {
@@ -1171,6 +1222,12 @@
    for (i = 0;i < numCount;i++) {
        fresult[(i + zeroCount) * 2] = numberCols[i * 2];
        fresult[(i + zeroCount) * 2 + 1] = numberCols[i * 2 + 1];
    }
    //TODO 如果是金额,且后面只有1位小数的,需要在末尾填充0
    if (type == 1&& one_point_num) {
        fresult[(numCount + zeroCount) * 2] = -1;
        fresult[(numCount + zeroCount) * 2 + 1] = -1;
    }
    //开始填充数据
@@ -2204,6 +2261,33 @@
    int unit_start = -1;
    int i;
    //查询是否有单位
      //获取是否有单位
    int last_empty_index = -1;
    for (i = endx;i >= startx;i--) {
        bool empty = 1;
        for (int y = starty;y < endy;y++) {
            if (get_binary_value(imgs[get_one_level_position(width, i, y)]) > 0) {
                empty = 0;
                break;
            }
        }
        if (empty) {
            last_empty_index = i;
            break;
        }
    }
    bool hasUnit = false;
    if (endx - last_empty_index > 6) {
        hasUnit = true;
    }
    else {
        //没有单位
        result[index] = 2;
        return;
    }
    for (i = endx - 11;i >= startx;i--) {
        bool empty = 1;
        for (int y = starty;y < endy;y++) {
ConsoleApplication/main.cpp
@@ -147,13 +147,7 @@
    cout << "开始程序" << endl;
    ImgUtil::init();
    bool dead= THSActionUtil::thsIsDead();
    //cv::imshow("test",cv::Mat(cv::imread("C:\\Users\\Administrator\\Desktop\\ocr\\limit_up\\企业微信截图_16624495173041.png"), cv::Rect(619, 123, 34, 10)));
    cv::Mat img = ImgUtil::grayImage(cv::imread("C:\\Users\\Administrator\\Desktop\\ocr\\时间.png"));
    cv::imwrite("C:\\Users\\Administrator\\Desktop\\ocr\\时间_gray.png", cv::Mat( img,cv::Rect(img.cols-60,0,60,19)));
    THSActionUtil::updateMainSite();
    cv::waitKey(0);
app/ExcelUtil.cpp
@@ -2,6 +2,8 @@
#include "ExcelUtil.h"
#include "json/json.h"
#include "xlslib.h"
#include <libxls/xlsstruct.h>
using namespace xls;
using namespace xlslib_core;
void ExcelUtil::save(list<TradeData> data, string path) {
@@ -94,3 +96,40 @@
    wb.Dump(path);
}
void ExcelUtil::read(string path)
{
    xlsWorkBook* pWB = NULL;
    // 工作表
    xlsWorkSheet* pWS = NULL;
    // 单元格
    xlsCell* cell = NULL;
    int sheetIndex;
    int row, col;
    // 打开文件
    pWB = xls_open(path.c_str(), "UTF-8");
    if (!pWB) {
        throw string("Open File Error!");
    }
    // 解析xls文件,这个不要忘了
    xls_parseWorkBook(pWB);
    fprintf(stderr, "Sheet count:%d\n", pWB->sheets.count);
    pWS = xls_getWorkSheet(pWB, 0);
    // 解析工作表
    xls_parseWorkSheet(pWS);
    fprintf(stderr, "Sheet %d name: %s\n", sheetIndex, (char*)pWB->sheets.sheet[sheetIndex].name);
    fprintf(stderr, "Sheet Data:\n");
    // 每行
    for (row = 0; row < pWS->rows.lastrow; ++row) {
        cell = xls_cell(pWS, row, 1);
        if (cell && cell->str) {
                fprintf(stderr, "%s", (char*)cell->str);
        }
    }
}
app/ExcelUtil.h
@@ -1,12 +1,14 @@
#pragma once
#include <L2DataCapture.h>
#include <afxstr.h>
#include <xls.h>
class ExcelUtil
{
public:
    static void save(list<TradeData> data, string path);
    static void read(string path);
};
app/JsonUtil.h
@@ -57,10 +57,12 @@
        return jsonStr;
    }
    static  std::string loadL2Data(int clientID, int channel, string code, std::list<TradeData> dataList) {
    static  std::string loadL2Data(int clientID, int channel, string code, long captureTime, long processTime, std::list<TradeData> dataList) {
        Json::Value data;
        data["channel"] = channel;
        data["code"] = code;
        data["captureTime"] = captureTime;
        data["processTime"] = processTime;
        data["data"] = toJson(dataList);
        Json::Value root;
        root["type"] = 0;
@@ -212,6 +214,8 @@
            Json::Value item;
            item["code"] = (*ele).code;
            item["price"] = (*ele).price;
            item["volumn"] = (*ele).volumn;
            item["volumnUnit"] = (*ele).volumnUnit;
            data[index++] = item;
        }
        root["data"] = data;
app/app.aps
Binary files differ
app/app.rc
Binary files differ
app/app.vcxproj
@@ -96,12 +96,12 @@
      <SDLCheck>false</SDLCheck>
      <PreprocessorDefinitions>_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
      <AdditionalIncludeDirectories>D:\workspace\CPlusTest\ConsoleApplication\xls_lib;D:\opencv\build\include\opencv2;D:\opencv\build\include;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\include;D:\workspace\CPlusTest\ConsoleApplication\ConsoleApplication\;D:\workspace\CPlusTest\ConsoleApplication\app\lib_json\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <AdditionalIncludeDirectories>D:\workspace\CPlusTest\ConsoleApplication\app\libxls\include;D:\workspace\CPlusTest\ConsoleApplication\xls_lib;D:\opencv\build\include\opencv2;D:\opencv\build\include;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\include;D:\workspace\CPlusTest\ConsoleApplication\ConsoleApplication\;D:\workspace\CPlusTest\ConsoleApplication\app\lib_json\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
    </ClCompile>
    <Link>
      <SubSystem>Windows</SubSystem>
      <AdditionalLibraryDirectories>D:\workspace\CPlusTest\ConsoleApplication\xlslib;D:\opencv\build\x64\vc15\lib;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\lib\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
      <AdditionalDependencies>opencv_world455d.lib;OpenCL.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
      <AdditionalLibraryDirectories>D:\opencv\build\x64\vc15\lib;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\lib\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
      <AdditionalDependencies>opencv_world455d.lib;OpenCL.lib;ws2_32.lib;libxls.lib;%(AdditionalDependencies)</AdditionalDependencies>
    </Link>
    <Midl>
      <MkTypLibCompatible>false</MkTypLibCompatible>
app/app.vcxproj.user
@@ -5,9 +5,9 @@
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
    <RemoteDebuggerCommand>\\192.168.3.242\FXDMounter\Debug\DataCapture.exe</RemoteDebuggerCommand>
    <RemoteDebuggerWorkingDirectory>\\192.168.3.242\FXDMounter\</RemoteDebuggerWorkingDirectory>
    <RemoteDebuggerServerName>192.168.3.242</RemoteDebuggerServerName>
    <RemoteDebuggerCommand>\\192.168.3.241\FXDMounter\Debug\DataCapture.exe</RemoteDebuggerCommand>
    <RemoteDebuggerWorkingDirectory>\\192.168.3.241\FXDMounter\</RemoteDebuggerWorkingDirectory>
    <RemoteDebuggerServerName>192.168.3.241</RemoteDebuggerServerName>
    <RemoteDebuggerConnection>RemoteWithoutAuthentication</RemoteDebuggerConnection>
  </PropertyGroup>
</Project>
app/appDlg.cpp
@@ -30,6 +30,7 @@
#include "loginDlg.h"
#include <psapi.h>
#pragma comment(lib,"psapi.lib")
#include "ExcelUtil.h"
// 用于应用程序“关于”菜单项的 CAboutDlg 对话框
@@ -130,6 +131,7 @@
    DDX_Control(pDX, IDC_CHECK_TRADE_TIME_TRADE_SUCCESS, tradeSuccessTimeCheck);
    DDX_Control(pDX, IDC_CHECK_TRADE_TIME_DELEGATE, delegateTimeCheck);
    DDX_Control(pDX, IDC_CHECK_TRADE_TIME_LIMIT_UP, limitUpTimeCheck);
    DDX_Control(pDX, IDC_BUTTON_UPLOAD_EXCEL_CODE, uploadExcelGPBtn);
}
BEGIN_MESSAGE_MAP(CappDlg, CDialogEx)
@@ -160,6 +162,7 @@
    ON_BN_CLICKED(IDC_CHECK_TRADE_TIME_TRADE_SUCCESS, &CappDlg::OnBnClickedCheckTradeTimeTradeSuccess)
    ON_BN_CLICKED(IDC_CHECK_TRADE_TIME_DELEGATE, &CappDlg::OnBnClickedCheckTradeTimeDelegate)
    ON_BN_CLICKED(IDC_CHECK_PRICE_TIME_LIMIT, &CappDlg::OnBnClickedCheckPriceTimeLimit)
    ON_BN_CLICKED(IDC_BUTTON_UPLOAD_EXCEL_CODE, &CappDlg::OnBnClickedButtonUploadExcelCode)
END_MESSAGE_MAP()
@@ -203,9 +206,17 @@
    L2DataCapture::setTradeTimeCapture(true);
    limitUpTimeCheck.SetCheck(TRUE);
    LimitUpCapture::setTradeTimeCapture(limitUpTimeCheck.GetCheck());
    tradeSuccessTimeCheck.SetCheck(TRUE);
    TradeListCapture::setTradeTimeCapture_success(tradeSuccessTimeCheck.GetCheck());
    delegateTimeCheck.SetCheck(TRUE);
    TradeListCapture::setTradeTimeCapture_delegate(delegateTimeCheck.GetCheck());
    priceTimeLimitCheck.SetCheck(TRUE);
    CurrentPriceCapture::setTradeTimeCapture(priceTimeLimitCheck.GetCheck());
@@ -273,9 +284,11 @@
    if (authoritySet.count(AUTHORITY_UPLOAD_CODE) > 0) {
        uploadGPBtn.EnableWindow(TRUE);
        uploadExcelGPBtn.EnableWindow(TRUE);
    }
    else {
        uploadGPBtn.EnableWindow(FALSE);
        uploadExcelGPBtn.EnableWindow(FALSE);
    }
@@ -352,14 +365,14 @@
}
void  CappDlg::OnL2DataCallback(int index, string code, list<TradeData> dataList, void* context) {
void  CappDlg::OnL2DataCallback(int index, string code, long captureTime, long processTime, list<TradeData> dataList, void* context) {
    //转为json
    CappDlg* app = (CappDlg*)context;
    //cout << "回调:" << std::this_thread::get_id() << ":" << index << endl;
    CButton* btn = (CButton*)app->GetDlgItem(IDC_CHECK1);
    bool check = btn->GetCheck();
    if (check) {
        string data = JsonUtil::loadL2Data(app->clientNum, index, code, dataList);
        string data = JsonUtil::loadL2Data(app->clientNum, index, code, captureTime, processTime, dataList);
        clock_t time_start = clock();
        try {
            app->socketManager->sendMsg(index, data.c_str());
@@ -562,6 +575,8 @@
                int key = (*ele).first;
                string value = (*ele).second;
                app->capture->setGPCode(key, value);
                cout << "代码位:" << key << " CODE:" << value;
                //TODO 记录日志
            }
            Sleep(500);
        }
@@ -735,6 +750,14 @@
        root["data"] = data;
        root["client"] = clientNum;
        return JsonUtil::toJsonStr(root);
    }
    else if (action == "updateTHSSite") {
        try {
            THSActionUtil::updateMainSite();
        }
        catch (string st) {
            throw st;
        }
    }
    return "";
@@ -1259,7 +1282,12 @@
    for (list<CString>::iterator ele = paths.begin();ele != paths.end();ele++) {
        CString path = *ele;
    std:string p = Tool::cstring2String(path);
        cv::Mat grayImg = gpDataCapture->grayImgs(cv::imread(p));
        cv::Mat img = cv::imread(p);
        //cv::Mat _img;
        //cv::resize(img, _img, cv::Size(img.cols * 2 / 3, img.rows * 2 / 3));
        cv::Mat grayImg = gpDataCapture->grayImgs(img);
        SplitType types[] = { NUM_TYPE_MONEY, NUM_TYPE_CODE };
@@ -1297,6 +1325,22 @@
    codesDataDlog dlg;
    dlg.DoModal();
}
// Excel上传股票代码
void CappDlg::OnBnClickedButtonUploadExcelCode()
{
    CString cpath = GUITool::selectImage();
std:string path = Tool::cstring2String(cpath);
    if (path.length() > 0)
    {
        ExcelUtil::read(path);
    }
}
//涨停上传
void CappDlg::OnBnClickedButton12()
@@ -1495,7 +1539,7 @@
    string data = JsonUtil::loadL2Data(clientNum, 0, "002338", dataList);
    string data = JsonUtil::loadL2Data(clientNum, 0, "002338",0,0, dataList);
    clock_t time_start = clock();
    try {
        socketManager->sendMsg(index, data.c_str());
@@ -1717,3 +1761,6 @@
    // 现价识别时段限制
    CurrentPriceCapture::setTradeTimeCapture(priceTimeLimitCheck.GetCheck());
}
app/appDlg.h
@@ -44,7 +44,7 @@
    THSL2RepairTool *thsL2RepairTool;
    void OnDataCallback(int index, list<TradeData> dataList);
    static void  OnL2DataCallback(int index,string code, list<TradeData> dataList, void* context);
    static void  OnL2DataCallback(int index,string code, long captureTime, long processTime, list<TradeData> dataList, void* context);
    static void  OnTradeQueueDataCallback(int index, string code, list<int> numList, void* context);
    static void  OnLimitUpDataCallback(list<LimitUpData> dataList, void* context);
    static void  OnTradeSuccessDataCallback(list<TradeSuccessData> dataList, void* context);
@@ -148,4 +148,6 @@
    afx_msg void OnBnClickedCheckTradeTimeTradeSuccess();
    afx_msg void OnBnClickedCheckTradeTimeDelegate();
    afx_msg void OnBnClickedCheckPriceTimeLimit();
    CButton uploadExcelGPBtn;
    afx_msg void OnBnClickedButtonUploadExcelCode();
};
app/libxls.dll
Binary files differ
app/libxls.lib
Binary files differ
app/libxls/bin/xls2csv.exe
Binary files differ
app/libxls/include/libxls/brdb.c.h
New file
@@ -0,0 +1,208 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 *
 * This file is part of libxls -- A multiplatform, C/C++ library
 * for parsing Excel(TM) files.
 *
 * Redistribution and use in source and binary forms, with or without modification, are
 * permitted provided that the following conditions are met:
 *
 *    1. Redistributions of source code must retain the above copyright notice, this list of
 *       conditions and the following disclaimer.
 *
 *    2. Redistributions in binary form must reproduce the above copyright notice, this list
 *       of conditions and the following disclaimer in the documentation and/or other materials
 *       provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY David Hoerl ''AS IS'' AND ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL David Hoerl OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * Copyright 2004 Komarov Valery
 * Copyright 2006 Christophe Leitienne
 * Copyright 2008-2012 David Hoerl
 *
 */
{ 0x00, "Unknown",    ""},
{ 0x06, "FORMULA",    "Cell Formula" },
{ 0x09, "BOF-BIFF2",    "Beginning of File" },
{ 0x0A, "EOF",    "End of File" },
{ 0x0C, "CALCCOUNT",    "Iteration Count" },
{ 0x0D, "CALCMODE",    "Calculation Mode" },
{ 0x0E, "PRECISION",    "Precision" },
{ 0x0F, "REFMODE",    "Reference Mode" },
{ 0x10, "DELTA",    "Iteration Increment" },
{ 0x11, "ITERATION",    "Iteration Mode" },
{ 0x12, "PROTECT",    "Protection Flag" },
{ 0x13, "PASSWORD",    "Protection Password" },
{ 0x14, "HEADER",    "Print Header on Each Page" },
{ 0x15, "FOOTER",    "Print Footer on Each Page" },
{ 0x16, "EXTERNCOUNT",    "Number of External References" },
{ 0x17, "EXTERNSHEET",    "External Reference" },
{ 0x19, "?WINDOWPROTECT",    " (biffview guessed)" },
{ 0x1A, "VERTICALPAGEBREAKS",    "Explicit Column Page Breaks" },
{ 0x1B, "HORIZONTALPAGEBREAKS",    "Explicit Row Page Breaks" },
{ 0x1C, "NOTE",    "Comment Associated with a Cell" },
{ 0x1D, "SELECTION",    "Current Selection" },
{ 0x22, "DATEMODE",    "1904 Date System" },
{ 0x26, "LEFTMARGIN",    "Left Margin Measurement" },
{ 0x27, "RIGHTMARGIN",    "Right Margin Measurement" },
{ 0x28, "TOPMARGIN",    "Top Margin Measurement" },
{ 0x29, "BOTTOMMARGIN",    "Bottom Margin Measurement" },
{ 0x2A, "PRINTHEADERS",    "Print Row/Column Labels" },
{ 0x2B, "PRINTGRIDLINES",    "Print Gridlines Flag" },
{ 0x2F, "FILEPASS",    "File Is Password-Protected" },
{ 0x31, "FONT",    "Font Description" },
{ 0x3C, "CONTINUE",    "Continues Long Records" },
{ 0x3D, "WINDOW1",    "Window Information" },
{ 0x40, "BACKUP",    "Save Backup Version of the File" },
{ 0x41, "PANE",    "Number of Panes and Their Position" },
{ 0x42, "CODEPAGE",    "Default Code Page" },
{ 0x4D, "PLS",    "Environment-Specific Print Record" },
{ 0x50, "DCON",    "Data Consolidation Information" },
{ 0x51, "DCONREF",    "Data Consolidation References" },
{ 0x52, "DCONNAME",    "Data Consolidation Named References" },
{ 0x55, "DEFCOLWIDTH",    "Default Width for Columns" },
{ 0x59, "XCT",    "CRN Record Count" },
{ 0x5A, "CRN",    "Nonresident Operands" },
{ 0x5B, "FILESHARING",    "File-Sharing Information" },
{ 0x5C, "WRITEACCESS",    "Write Access User Name" },
{ 0x5D, "OBJ",    "Describes a Graphic Object" },
{ 0x5E, "UNCALCED",    "Recalculation Status" },
{ 0x5F, "SAVERECALC",    "Recalculate Before Save" },
{ 0x60, "TEMPLATE",    "Workbook Is a Template" },
{ 0x63, "OBJPROTECT",    "Objects Are Protected" },
{ 0x7D, "COLINFO",    "Column Formatting Information" },
{ 0x7F, "IMDATA",    "Image Data" },
{ 0x80, "GUTS",    "Size of Row and Column Gutters" },
{ 0x81, "WSBOOL",    "Additional Workspace Information" },
{ 0x82, "GRIDSET",    "State Change of Gridlines Option" },
{ 0x83, "HCENTER",    "Center Between Horizontal Margins" },
{ 0x84, "VCENTER",    "Center Between Vertical Margins" },
{ 0x85, "BOUNDSHEET",    "Sheet Information" },
{ 0x86, "WRITEPROT",    "Workbook Is Write-Protected" },
{ 0x87, "ADDIN",    "Workbook Is an Add-in Macro" },
{ 0x88, "EDG",    "Edition Globals" },
{ 0x89, "PUB",    "Publisher" },
{ 0x8C, "COUNTRY",    "Default Country and WIN.INI Country" },
{ 0x8D, "HIDEOBJ",    "Object Display Options" },
{ 0x90, "SORT",    "Sorting Options" },
{ 0x91, "SUB",    "Subscriber" },
{ 0x92, "PALETTE",    "Color Palette Definition" },
{ 0x94, "LHRECORD",    ".WK? File Conversion Information" },
{ 0x95, "LHNGRAPH",    "Named Graph Information" },
{ 0x96, "SOUND",    "Sound Note" },
{ 0x99, "STANDARDWIDTH",    "Standard Column Width" },
{ 0x98, "LPR",    "Sheet Was Printed Using LINE.PRINT" },
{ 0x9A, "FNGROUPNAME",    "Function Group Name" },
{ 0x9B, "FILTERMODE",    "Sheet Contains Filtered List" },
{ 0x9C, "FNGROUPCOUNT",    "Built-in Function Group Count" },
{ 0x9D, "AUTOFILTERINFO",    "Drop-Down Arrow Count" },
{ 0x9E, "AUTOFILTER",    "AutoFilter Data" },
{ 0xA0, "SCL",    "Window Zoom Magnification" },
{ 0xA1, "SETUP",    "Page Setup" },
{ 0xA9, "COORDLIST",    "Polygon Object Vertex Coordinates" },
{ 0xAB, "GCW",    "Global Column-Width Flags" },
{ 0xAE, "SCENMAN",    "Scenario Output Data" },
{ 0xAF, "SCENARIO",    "Scenario Data" },
{ 0xB0, "SXVIEW",    "View Definition" },
{ 0xB1, "SXVD",    "View Fields" },
{ 0xB2, "SXVI",    "View Item" },
{ 0xB4, "SXIVD",    "Row/Column Field IDs" },
{ 0xB5, "SXLI",    "Line Item Array" },
{ 0xB6, "SXPI",    "Page Item" },
{ 0xB8, "DOCROUTE",    "Routing Slip Information" },
{ 0xB9, "RECIPNAME",    "Recipient Name" },
{ 0xBC, "SHRFMLA",    "Shared Formula" },
{ 0xBD, "MULRK",    "Multiple RK Cells" },
{ 0xBE, "MULBLANK",    "Multiple Blank Cells" },
{ 0xC1, "MMS",    "ADDMENU/DELMENU Record Group Count" },
{ 0xC2, "ADDMENU",    "Menu Addition" },
{ 0xC3, "DELMENU",    "Menu Deletion" },
{ 0xC5, "SXDI",    "Data Item" },
{ 0xC6, "SXDB",    "PivotTable Cache Data" },
{ 0xCD, "SXSTRING",    "String" },
{ 0xD0, "SXTBL",    "Multiple Consolidation Source Info" },
{ 0xD1, "SXTBRGIITM",    "Page Item Name Count" },
{ 0xD2, "SXTBPG",    "Page Item Indexes" },
{ 0xD3, "OBPROJ",    "Visual Basic Project" },
{ 0xD5, "SXIDSTM",    "Stream ID" },
{ 0xD6, "RSTRING",    "Cell with Character Formatting" },
{ 0xD7, "DBCELL",    "Stream Offsets" },
{ 0xDA, "BOOKBOOL",    "Workbook Option Flag" },
{ 0xDC, "PARAMQRY-SXEXT",    "Query Parameters-External Source Information" },
{ 0xDD, "SCENPROTECT",    "Scenario Protection" },
{ 0xDE, "OLESIZE",    "Size of OLE Object" },
{ 0xDF, "UDDESC",    "Description String for Chart Autoformat" },
{ 0xE0, "XF",    "Extended Format" },
{ 0xE1, "INTERFACEHDR",    "Beginning of User Interface Records" },
{ 0xE2, "INTERFACEEND",    "End of User Interface Records" },
{ 0xE3, "SXVS",    "View Source" },
{ 0xE5, "CSPAN",    "Cells span" },
{ 0xEA, "TABIDCONF",    "Sheet Tab ID of Conflict History" },
{ 0xEB, "MSODRAWINGGROUP",    "Microsoft Office Drawing Group" },
{ 0xEC, "MSODRAWING",    "Microsoft Office Drawing" },
{ 0xED, "MSODRAWINGSELECTION",    "Microsoft Office Drawing Selection" },
{ 0xF0, "SXRULE",    "PivotTable Rule Data" },
{ 0xF1, "SXEX",    "PivotTable View Extended Information" },
{ 0xF2, "SXFILT",    "PivotTable Rule Filter" },
{ 0xF6, "SXNAME",    "PivotTable Name" },
{ 0xF7, "SXSELECT",    "PivotTable Selection Information" },
{ 0xF8, "SXPAIR",    "PivotTable Name Pair" },
{ 0xF9, "SXFMLA",    "PivotTable Parsed Expression" },
{ 0xFB, "SXFORMAT",    "PivotTable Format Record" },
{ 0xFC, "SST",    "Shared String Table" },
{ 0xFD, "LABELSST",    "Cell Value, String Constant/SST" },
{ 0xFF, "EXTSST",    "Extended Shared String Table" },
{ 0x100, "SXVDEX",    "Extended PivotTable View Fields" },
{ 0x103, "SXFORMULA",    "PivotTable Formula Record" },
{ 0x122, "SXDBEX",    "PivotTable Cache Data" },
{ 0x13D, "TABID",    "Sheet Tab Index Array" },
{ 0x160, "USESELFS",    "Natural Language Formulas Flag" },
{ 0x161, "DSF",    "Double Stream File" },
{ 0x162, "XL5MODIFY",    "Flag for DSF" },
{ 0x1A5, "FILESHARING2",    "File-Sharing Information for Shared Lists" },
{ 0x1A9, "USERBVIEW",    "Workbook Custom View Settings" },
{ 0x1AA, "USERSVIEWBEGIN",    "Custom View Settings" },
{ 0x1AB, "USERSVIEWEND",    "End of Custom View Records" },
{ 0x1AD, "QSI",    "External Data Range" },
{ 0x1AE, "SUPBOOK",    "Supporting Workbook" },
{ 0x1AF, "PROT4REV",    "Shared Workbook Protection Flag" },
{ 0x1B0, "CONDFMT",    "Conditional Formatting Range Information" },
{ 0x1B1, "CF",    "Conditional Formatting Conditions" },
{ 0x1B2, "DVAL",    "Data Validation Information" },
{ 0x1B5, "DCONBIN",    "Data Consolidation Information" },
{ 0x1B6, "TXO",    "Text Object" },
{ 0x1B7, "REFRESHALL",    "Refresh Flag" },
{ 0x1B8, "HLINK",    "Hyperlink" },
{ 0x1BB, "SXFDBTYPE",    "SQL Datatype Identifier" },
{ 0x1BC, "PROT4REVPASS",    "Shared Workbook Protection Password" },
{ 0x1BE, "DV",    "Data Validation Criteria" },
{ 0x200, "DIMENSIONS",    "Cell Table Size" },
{ 0x201, "BLANK",    "Cell Value, Blank Cell" },
{ 0x203, "NUMBER",    "Cell Value, Floating-Point Number" },
{ 0x204, "LABEL",    "Cell Value, String Constant" },
{ 0x205, "BOOLERR",    "Cell Value, Boolean or Error" },
{ 0x207, "STRING",    "String Value of a Formula" },
{ 0x208, "ROW",    "Describes a Row" },
{ 0x209, "BOF-BIFF3",    "Beginning of File" },
{ 0x20B, "INDEX",    "Index Record" },
{ 0x218, "NAME",    "Defined Name" },
{ 0x221, "ARRAY",    "Array-Entered Formula" },
{ 0x223, "EXTERNNAME",    "Externally Referenced Name" },
{ 0x225, "DEFAULTROWHEIGHT",    "Default Row Height" },
{ 0x236, "TABLE",    "Data Table" },
{ 0x23E, "WINDOW2",    "Sheet Window Information" },
{ 0x27E, "RK",    "Cell Value, RK Number" },
{ 0x293, "STYLE",    "Style Information" },
{ 0x409, "BOF-BIFF4",    "Beginning of File" },
{ 0x41E, "FORMAT",    "Number Format" },
{ 0x4BC, "?FORMULA-RELATED=?(BC=SHRFMLA))",    "Formula related, always before there are 0x06 (FORMULA)" },
{ 0x809, "BOF-BIFF5/7/8",    "Beginning of File" },
{ 0xFFF, "",    "" },
app/libxls/include/libxls/brdb.h
New file
@@ -0,0 +1,58 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 *
 * This file is part of libxls -- A multiplatform, C/C++ library
 * for parsing Excel(TM) files.
 *
 * Redistribution and use in source and binary forms, with or without modification, are
 * permitted provided that the following conditions are met:
 *
 *    1. Redistributions of source code must retain the above copyright notice, this list of
 *       conditions and the following disclaimer.
 *
 *    2. Redistributions in binary form must reproduce the above copyright notice, this list
 *       of conditions and the following disclaimer in the documentation and/or other materials
 *       provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY David Hoerl ''AS IS'' AND ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL David Hoerl OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * Copyright 2004 Komarov Valery
 * Copyright 2006 Christophe Leitienne
 * Copyright 2008-2012 David Hoerl
 *
 */
struct str_brdb
{
    WORD opcode;
    char * name;            /* printable name */
    char * desc;            /* printable description */
};
typedef struct str_brdb record_brdb;
record_brdb brdb[] =
    {
#include <libxls/brdb.c.h>
    };
static int get_brbdnum(int id)
{
    int i;
    i=0;
    do
    {
        if (brdb[i].opcode==id)
            return i;
        i++;
    }
    while (brdb[i].opcode!=0xFFF);
    return 0;
}
app/libxls/include/libxls/ole.h
New file
@@ -0,0 +1,173 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 *
 * This file is part of libxls -- A multiplatform, C/C++ library
 * for parsing Excel(TM) files.
 *
 * Redistribution and use in source and binary forms, with or without modification, are
 * permitted provided that the following conditions are met:
 *
 *    1. Redistributions of source code must retain the above copyright notice, this list of
 *       conditions and the following disclaimer.
 *
 *    2. Redistributions in binary form must reproduce the above copyright notice, this list
 *       of conditions and the following disclaimer in the documentation and/or other materials
 *       provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY David Hoerl ''AS IS'' AND ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL David Hoerl OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * Copyright 2004 Komarov Valery
 * Copyright 2006 Christophe Leitienne
 * Copyright 2013 Bob Colbert
 * Copyright 2008-2013 David Hoerl
 *
 */
#ifndef OLE_INCLUDE
#define OLE_INCLUDE
#include <stdio.h>            // FILE *
#include "libxls/xlstypes.h"
#ifdef AIX
#pragma pack(1)
#else
#pragma pack(push, 1)
#endif
typedef struct TIME_T
{
    DWORD    LowDate;
    DWORD    HighDate;
}
TIME_T;
typedef struct OLE2Header
{
    DWORD        id[2];        //D0CF11E0 A1B11AE1
    DWORD        clid[4];
    WORD        verminor;    //0x3e
    WORD        verdll;        //0x03
    WORD        byteorder;
    WORD        lsectorB;
    WORD        lssectorB;
    WORD        reserved1;
    DWORD        reserved2;
    DWORD        reserved3;
    DWORD        cfat;            // count full sectors
    DWORD        dirstart;
    DWORD        reserved4;
    DWORD        sectorcutoff;    // min size of a standard stream ; if less than this then it uses short-streams
    DWORD        sfatstart;        // first short-sector or EOC
    DWORD        csfat;            // count short sectors
    DWORD        difstart;        // first sector master sector table or EOC
    DWORD        cdif;            // total count
    DWORD        MSAT[109];        // First 109 MSAT
}
OLE2Header;
#pragma pack(pop)
//-----------------------------------------------------------------------------------
typedef    struct st_olefiles
{
    long count;
    struct st_olefiles_data
    {
        BYTE*    name;
        DWORD    start;
        DWORD    size;
   }
    * file;
}
st_olefiles;
typedef struct OLE2
{
    FILE*        file;
    WORD        lsector;
    WORD        lssector;
    DWORD        cfat;
    DWORD        dirstart;
    DWORD        sectorcutoff;
    DWORD        sfatstart;
    DWORD        csfat;
    DWORD        difstart;
    DWORD        cdif;
    DWORD*        SecID;    // regular sector data
    DWORD*        SSecID;    // short sector data
    BYTE*        SSAT;    // directory of short sectors
    st_olefiles    files;
}
OLE2;
typedef struct OLE2Stream
{
    OLE2*    ole;
    DWORD    start;
    size_t    pos;
    size_t    cfat;
    size_t    size;
    size_t    fatpos;
    BYTE*    buf;
    DWORD    bufsize;
    BYTE    eof;
    BYTE    sfat;    // short
}
OLE2Stream;
#ifdef AIX
#pragma pack(1)
#else
#pragma pack(push, 1)
#endif
typedef struct PSS
{
    BYTE    name[64];
    WORD    bsize;
    BYTE    type;        //STGTY
#define PS_EMPTY        00
#define PS_USER_STORAGE    01
#define PS_USER_STREAM    02
#define PS_USER_ROOT    05
    BYTE    flag;        //COLOR
#define BLACK    1
    DWORD    left;
    DWORD    right;
    DWORD    child;
    WORD    guid[8];
    DWORD    userflags;
    TIME_T    time[2];
    DWORD    sstart;
    DWORD    size;
    DWORD    proptype;
}
PSS;
#pragma pack(pop)
extern size_t ole2_read(void* buf,size_t size,size_t count,OLE2Stream* olest);
extern OLE2Stream* ole2_sopen(OLE2* ole,DWORD start, size_t size);
extern void ole2_seek(OLE2Stream* olest,DWORD ofs);
extern OLE2Stream*  ole2_fopen(OLE2* ole,BYTE* file);
extern void ole2_fclose(OLE2Stream* ole2st);
extern OLE2* ole2_open(const BYTE *file);
extern void ole2_close(OLE2* ole2);
extern void ole2_bufread(OLE2Stream* olest);
#endif
app/libxls/include/libxls/xlsstruct.h
New file
@@ -0,0 +1,478 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 *
 * This file is part of libxls -- A multiplatform, C/C++ library
 * for parsing Excel(TM) files.
 *
 * Redistribution and use in source and binary forms, with or without modification, are
 * permitted provided that the following conditions are met:
 *
 *    1. Redistributions of source code must retain the above copyright notice, this list of
 *       conditions and the following disclaimer.
 *
 *    2. Redistributions in binary form must reproduce the above copyright notice, this list
 *       of conditions and the following disclaimer in the documentation and/or other materials
 *       provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY David Hoerl ''AS IS'' AND ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL David Hoerl OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * Copyright 2004 Komarov Valery
 * Copyright 2006 Christophe Leitienne
 * Copyright 2013 Bob Colbert
 * Copyright 2008-2013 David Hoerl
 *
 */
#ifndef XLS_STRUCT_INC
#define XLS_STRUCT_INC
#include "libxls/ole.h"
#ifdef AIX
#pragma pack(1)
#else
#pragma pack(push, 1)
#endif
typedef struct BOF
{
    WORD id;
    WORD size;
}
BOF;
typedef struct BIFF
{
    WORD ver;
    WORD type;
    WORD id_make;
    WORD year;
    DWORD flags;
    DWORD min_ver;
    BYTE buf[100];
}
BIFF;
typedef struct WIND1
{
    WORD xWn;
    WORD yWn;
    WORD dxWn;
    WORD dyWn;
    WORD grbit;
    WORD itabCur;
    WORD itabFirst;
    WORD ctabSel;
    WORD wTabRatio;
}
WIND1;
typedef struct BOUNDSHEET
{
    DWORD    filepos;
    BYTE    type;
    BYTE    visible;
    BYTE    name[];
}
BOUNDSHEET;
typedef struct ROW
{
    WORD    index;
    WORD    fcell;
    WORD    lcell;
    WORD    height;
    WORD    notused;
    WORD    notused2; //used only for BIFF3-4
    WORD    flags;
    WORD    xf;
}
ROW;
typedef struct COL
{
    WORD    row;
    WORD    col;
    WORD    xf;
}
COL;
typedef struct FORMULA // BIFF8
{
    WORD    row;
    WORD    col;
    WORD    xf;
    // next 8 bytes either a IEEE double, or encoded on a byte basis
    BYTE    resid;
    BYTE    resdata[5];
    WORD    res;
    WORD    flags;
    BYTE    chn[4]; // BIFF8
    WORD    len;
    BYTE    value[1]; //var
}
FORMULA;
typedef struct FARRAY // BIFF8
{
    WORD    row1;
    WORD    row2;
    BYTE    col1;
    BYTE    col2;
    WORD    flags;
    BYTE    chn[4]; // BIFF8
    WORD    len;
    BYTE    value[1]; //var
}
FARRAY;
typedef struct RK
{
    WORD    row;
    WORD    col;
    WORD    xf;
    DWORD_UA value;
}
RK;
typedef struct MULRK
{
    WORD    row;
    WORD    col;
    struct {
        WORD    xf;
        DWORD_UA value;
    }        rk[];
    //WORD    last_col;
}
MULRK;
typedef struct MULBLANK
{
    WORD    row;
    WORD    col;
    WORD    xf[];
    //WORD    last_col;
}
MULBLANK;
typedef struct BLANK
{
    WORD    row;
    WORD    col;
    WORD    xf;
}
BLANK;
typedef struct LABEL
{
    WORD    row;
    WORD    col;
    WORD    xf;
    BYTE    value[1]; // var
}
LABEL;
typedef LABEL LABELSST;
typedef struct SST
{
    DWORD    num;
    DWORD    numofstr;
    BYTE    strings;
}
SST;
typedef struct XF5
{
    WORD    font;
    WORD    format;
    WORD    type;
    WORD    align;
    WORD    color;
    WORD    fill;
    WORD    border;
    WORD    linestyle;
}
XF5;
typedef struct XF8
{
    WORD    font;
    WORD    format;
    WORD    type;
    BYTE    align;
    BYTE    rotation;
    BYTE    ident;
    BYTE    usedattr;
    DWORD    linestyle;
    DWORD    linecolor;
    WORD    groundcolor;
}
XF8;
typedef struct BR_NUMBER
{
    WORD    row;
    WORD    col;
    WORD    xf;
    double value;
}
BR_NUMBER;
typedef struct COLINFO
{
    WORD    first;
    WORD    last;
    WORD    width;
    WORD    xf;
    WORD    flags;
    WORD    notused;
}
COLINFO;
typedef struct MERGEDCELLS
{
    WORD    rowf;
    WORD    rowl;
    WORD    colf;
    WORD    coll;
}
MERGEDCELLS;
typedef struct FONT
{
    WORD    height;
    WORD    flag;
    WORD    color;
    WORD    bold;
    WORD    escapement;
    BYTE    underline;
    BYTE    family;
    BYTE    charset;
    BYTE    notused;
    BYTE    name;
}
FONT;
typedef struct FORMAT
{
    WORD    index;
    BYTE    value[0];
}
FORMAT;
#pragma pack(pop)
//---------------------------------------------------------
typedef    struct st_sheet
{
    DWORD count;        // Count of sheets
    struct st_sheet_data
    {
        DWORD filepos;
        BYTE visibility;
        BYTE type;
        BYTE* name;
    }
    * sheet;
}
st_sheet;
typedef    struct st_font
{
    DWORD count;        // Count of FONT's
    struct st_font_data
    {
        WORD    height;
        WORD    flag;
        WORD    color;
        WORD    bold;
        WORD    escapement;
        BYTE    underline;
        BYTE    family;
        BYTE    charset;
        BYTE*    name;
    }
    * font;
}
st_font;
typedef struct st_format
{
    DWORD count;        // Count of FORMAT's
    struct st_format_data
    {
         WORD index;
         BYTE *value;
    }
    * format;
}
st_format;
typedef    struct st_xf
{
    DWORD count;    // Count of XF
    //    XF** xf;
    struct st_xf_data
    {
        WORD    font;
        WORD    format;
        WORD    type;
        BYTE    align;
        BYTE    rotation;
        BYTE    ident;
        BYTE    usedattr;
        DWORD    linestyle;
        DWORD    linecolor;
        WORD    groundcolor;
    }
    * xf;
}
st_xf;
typedef    struct st_sst
{
    DWORD count;
    DWORD lastid;
    DWORD continued;
    DWORD lastln;
    DWORD lastrt;
    DWORD lastsz;
    struct str_sst_string
    {
        BYTE* str;
    }
    * string;
}
st_sst;
typedef    struct st_cell
{
    DWORD count;
    struct st_cell_data
    {
        WORD    id;
        WORD    row;
        WORD    col;
        WORD    xf;
        BYTE*    str;        // String value;
        double    d;
        int32_t    l;
        WORD    width;        // Width of col
        WORD    colspan;
        WORD    rowspan;
        BYTE    isHidden;    // Is cell hidden
    }
    * cell;
}
st_cell;
typedef    struct st_row
{
    //    DWORD count;
    WORD lastcol;    // numCols - 1
    WORD lastrow;    // numRows - 1
    struct st_row_data
    {
        WORD index;
        WORD fcell;
        WORD lcell;
        WORD height;
        WORD flags;
        WORD xf;
        BYTE xfflags;
        st_cell cells;
    }
    * row;
}
st_row;
typedef    struct st_colinfo
{
    DWORD count;                //Count of COLINFO
    struct st_colinfo_data
    {
        WORD    first;
        WORD    last;
        WORD    width;
        WORD    xf;
        WORD    flags;
    }
    * col;
}
st_colinfo;
typedef struct xlsWorkBook
{
    //FILE*        file;
    OLE2Stream*    olestr;
    int32_t        filepos;        // position in file
    //From Header (BIFF)
    BYTE        is5ver;
    BYTE        is1904;
    WORD        type;
    //Other data
    WORD        codepage;        //Charset codepage
    char*        charset;
    st_sheet    sheets;
    st_sst        sst;            //SST table
    st_xf        xfs;            //XF table
    st_font        fonts;
    st_format    formats;        //FORMAT table
    char        *summary;        // ole file
    char        *docSummary;    // ole file
}
xlsWorkBook;
typedef struct xlsWorkSheet
{
    DWORD        filepos;
    WORD        defcolwidth;
    st_row        rows;
    xlsWorkBook *workbook;
    st_colinfo    colinfo;
}
xlsWorkSheet;
#ifdef __cplusplus
typedef struct st_cell::st_cell_data xlsCell;
typedef    struct st_row::st_row_data xlsRow;
#else
typedef struct st_cell_data xlsCell;
typedef    struct st_row_data xlsRow;
#endif
typedef struct xls_summaryInfo
{
    BYTE        *title;
    BYTE        *subject;
    BYTE        *author;
    BYTE        *keywords;
    BYTE        *comment;
    BYTE        *lastAuthor;
    BYTE        *appName;
    BYTE        *category;
    BYTE        *manager;
    BYTE        *company;
}
xlsSummaryInfo;
typedef void (*xls_formula_handler)(WORD bof, WORD len, BYTE *formula);
#endif
app/libxls/include/libxls/xlstool.h
New file
@@ -0,0 +1,52 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 *
 * This file is part of libxls -- A multiplatform, C/C++ library
 * for parsing Excel(TM) files.
 *
 * Redistribution and use in source and binary forms, with or without modification, are
 * permitted provided that the following conditions are met:
 *
 *    1. Redistributions of source code must retain the above copyright notice, this list of
 *       conditions and the following disclaimer.
 *
 *    2. Redistributions in binary form must reproduce the above copyright notice, this list
 *       of conditions and the following disclaimer in the documentation and/or other materials
 *       provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY David Hoerl ''AS IS'' AND ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL David Hoerl OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * Copyright 2004 Komarov Valery
 * Copyright 2006 Christophe Leitienne
 * Copyright 2013 Bob Colbert
 * Copyright 2008-2013 David Hoerl
 *
 */
#include "libxls/xlsstruct.h"
extern void dumpbuf(BYTE* fname,long size,BYTE* buf);
extern void verbose(char* str);
extern BYTE *utf8_decode(BYTE *str, DWORD len, char *encoding);
extern BYTE* unicode_decode(const BYTE *s, int len, size_t *newlen, const char* encoding);
extern BYTE* get_string(BYTE *s,BYTE is2, BYTE isUnicode, char *charset);
extern DWORD xls_getColor(const WORD color,WORD def);
extern void xls_showBookInfo(xlsWorkBook* pWB);
extern void xls_showROW(struct st_row_data* row);
extern void xls_showColinfo(struct st_colinfo_data* col);
extern void xls_showCell(struct st_cell_data* cell);
extern void xls_showFont(struct st_font_data* font);
extern void xls_showXF(XF8* xf);
extern void xls_showFormat(struct st_format_data* format);
extern BYTE* xls_getfcell(xlsWorkBook* pWB,struct st_cell_data* cell,WORD *label);
extern char* xls_getCSS(xlsWorkBook* pWB);
extern void xls_showBOF(BOF* bof);
app/libxls/include/libxls/xlstypes.h
New file
@@ -0,0 +1,56 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 *
 * This file is part of libxls -- A multiplatform, C/C++ library
 * for parsing Excel(TM) files.
 *
 * Redistribution and use in source and binary forms, with or without modification, are
 * permitted provided that the following conditions are met:
 *
 *    1. Redistributions of source code must retain the above copyright notice, this list of
 *       conditions and the following disclaimer.
 *
 *    2. Redistributions in binary form must reproduce the above copyright notice, this list
 *       of conditions and the following disclaimer in the documentation and/or other materials
 *       provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY David Hoerl ''AS IS'' AND ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL David Hoerl OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * Copyright 2004 Komarov Valery
 * Copyright 2006 Christophe Leitienne
 * Copyright 2013 Bob Colbert
 * Copyright 2008-2013 David Hoerl
 *
 */
#ifndef XLS_TYPES_INC
#define XLS_TYPES_INC
#include <stdint.h>
typedef unsigned char        BYTE;
typedef uint16_t            WORD;
typedef uint32_t            DWORD;
#ifdef NO_ALIGN
typedef uint16_t            WORD_UA;
typedef uint32_t            DWORD_UA;
#else
#ifdef _WIN32
typedef __declspec(align(1)) uint16_t WORD_UA;
typedef __declspec(align(1)) uint32_t DWORD_UA;
#else
typedef uint16_t            WORD_UA        __attribute__((aligned(1)));    // 2 bytes
typedef uint32_t            DWORD_UA    __attribute__((aligned(1)));    // 4 bytes
#endif
#endif
#endif
app/libxls/include/xls.h
New file
@@ -0,0 +1,76 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 *
 * This file is part of libxls -- A multiplatform, C/C++ library
 * for parsing Excel(TM) files.
 *
 * Redistribution and use in source and binary forms, with or without modification, are
 * permitted provided that the following conditions are met:
 *
 *    1. Redistributions of source code must retain the above copyright notice, this list of
 *       conditions and the following disclaimer.
 *
 *    2. Redistributions in binary form must reproduce the above copyright notice, this list
 *       of conditions and the following disclaimer in the documentation and/or other materials
 *       provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY David Hoerl ''AS IS'' AND ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL David Hoerl OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * Copyright 2004 Komarov Valery
 * Copyright 2006 Christophe Leitienne
 * Copyright 2008-2012 David Hoerl
 *
 */
#ifndef XLS_INCLUDE
#define XLS_INCLUDE
#ifdef __cplusplus
namespace xls {
extern "C" {
#endif
#include "libxls/xlstypes.h"
#include "libxls/xlsstruct.h"
#include "libxls/xlstool.h"
#define BLANK_CELL        0x0201
extern const char* xls_getVersion(void);
extern int xls(int debug);    // Set debug. Force library to load?
extern void xls_set_formula_hander(xls_formula_handler handler);
extern void xls_parseWorkBook(xlsWorkBook* pWB);
extern void xls_parseWorkSheet(xlsWorkSheet* pWS);
extern xlsWorkBook* xls_open(const char *file,const char *charset);    // convert 16bit strings within the spread sheet to this 8-bit encoding (UTF-8 default)
#define xls_close xls_close_WB                  // historical
extern void xls_close_WB(xlsWorkBook* pWB);     // preferred name
extern xlsWorkSheet * xls_getWorkSheet(xlsWorkBook* pWB,int num);
extern void xls_close_WS(xlsWorkSheet* pWS);
extern xlsSummaryInfo *xls_summaryInfo(xlsWorkBook* pWB);
extern void xls_close_summaryInfo(xlsSummaryInfo *pSI);
// utility function
xlsRow *xls_row(xlsWorkSheet* pWS, WORD cellRow);
xlsCell    *xls_cell(xlsWorkSheet* pWS, WORD cellRow, WORD cellCol);
#ifdef __cplusplus
} // extern c block
} // namespace
#endif
#endif
app/libxls/lib/endian.o
Binary files differ
app/libxls/lib/libxls.def
New file
@@ -0,0 +1,76 @@
EXPORTS
    brdb @1 DATA
    dumpbuf @2
    get_string @3
    ole2_bufread @4
    ole2_close @5
    ole2_fclose @6
    ole2_fopen @7
    ole2_open @8
    ole2_read @9
    ole2_seek @10
    ole2_sopen @11
    unicode_decode @12
    utf8_decode @13
    verbose @14
    xls @15
    xlsConvertBiff @16
    xlsConvertBof @17
    xlsConvertBoundsheet @18
    xlsConvertCol @19
    xlsConvertColinfo @20
    xlsConvertDouble @21
    xlsConvertFont @22
    xlsConvertFormat @23
    xlsConvertFormula @24
    xlsConvertFormulaArray @25
    xlsConvertHeader @26
    xlsConvertMergedcells @27
    xlsConvertPss @28
    xlsConvertRow @29
    xlsConvertSst @30
    xlsConvertWindow @31
    xlsConvertXf5 @32
    xlsConvertXf8 @33
    xlsIntVal @34
    xlsShortVal @35
    xls_addCell @36
    xls_addColinfo @37
    xls_addFont @38
    xls_addFormat @39
    xls_addRow @40
    xls_addSST @41
    xls_addSheet @42
    xls_addXF5 @43
    xls_addXF8 @44
    xls_appendSST @45
    xls_cell @46
    xls_close_WB @47
    xls_close_WS @48
    xls_close_summaryInfo @49
    xls_debug @50 DATA
    xls_dumpSummary @51
    xls_formatColumn @52
    xls_getCSS @53
    xls_getColor @54
    xls_getVersion @55
    xls_getWorkSheet @56
    xls_getfcell @57
    xls_is_bigendian @58
    xls_makeTable @59
    xls_mergedCells @60
    xls_open @61
    xls_parseWorkBook @62
    xls_parseWorkSheet @63
    xls_preparseWorkSheet @64
    xls_row @65
    xls_set_formula_hander @66
    xls_showBOF @67
    xls_showBookInfo @68
    xls_showCell @69
    xls_showColinfo @70
    xls_showFont @71
    xls_showFormat @72
    xls_showROW @73
    xls_showXF @74
    xls_summaryInfo @75
app/libxls/lib/libxls.dll
Binary files differ
app/libxls/lib/libxls.exp
Binary files differ
app/libxls/lib/libxls.lib
Binary files differ
app/libxls/lib/libxlsreader.a
Binary files differ
app/libxls/lib/libxlsreader.la
New file
@@ -0,0 +1,41 @@
# libxlsreader.la - a libtool library file
# Generated by libtool (GNU libtool) 2.2.10
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# The name that we can dlopen(3).
dlname=''
# Names of this library.
library_names=''
# The name of the static archive.
old_library='libxlsreader.a'
# Linker flags that can not go in dependency_libs.
inherited_linker_flags=''
# Libraries that this one depends upon.
dependency_libs=' -liconv'
# Names of additional weak libraries provided by this library
weak_library_names=''
# Version information for libxlsreader.
current=3
age=2
revision=1
# Is this an already installed library?
installed=yes
# Should we warn about portability when linking against -modules?
shouldnotlink=no
# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''
# Directory that this library needs to be installed in:
libdir='/usr/local/libxls/lib'
app/libxls/lib/ole.o
Binary files differ
app/libxls/lib/xls.o
Binary files differ
app/libxls/lib/xlstool.o
Binary files differ
app/resource.h
@@ -50,6 +50,7 @@
#define IDC_CHECK_TRADE_TIME_DELEGATE   1044
#define IDC_CHECK_TRADE_TIME_TRADE_SUCCESS 1045
#define IDC_CHECK_TRADE_TIME_LIMIT_UP   1046
#define IDC_BUTTON_UPLOAD_EXCEL_CODE    1047
// Next default values for new objects
// 
@@ -57,7 +58,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE        136
#define _APS_NEXT_COMMAND_VALUE         32771
#define _APS_NEXT_CONTROL_VALUE         1045
#define _APS_NEXT_CONTROL_VALUE         1048
#define _APS_NEXT_SYMED_VALUE           101
#endif
#endif
app/user.txt
@@ -1,3 +1,3 @@
client3
admin
123456
0