积累日常生活的点滴,开发过程的心得。

系统移植的一个常见问题

最近要把一个其他系统上的程序移植到Windows,其中用到一个数据文件,用原来的程序在Windows上编译后,一运行就访问越界,跟踪后发现,解析文件数据时,凡是读取ULong的地方,数据都取反了,问了一下,原来系统是基于Motorola的CPU的,而motorola CPU同Intel CPU的Word中高低位字节存放顺序正好是反的,因此ULong转换失败,写了一个高低字节转换程序就OK了。这应该是异构系统移植一个常见问题

发布Sqlite Developer Preview 0.8

更新历史

  • Fixed:Registered Db was not loaded after starting program(Which was not corrected as expected in ver0.75).
  • New: Basic index management (drop , reindex, create, view).
  • Updated: Added Data Edit Tab to Edit Table Dialog.
  • Update: Add Hints to toolbar button.
  • New: Add reindex function to table.
  • Fixed: Trigger display order was not correct.
  • Fixed: created table display order was not correct.
  • Fixed: options dialog always show the data export options even select sql editor option node. (Introduced in ver0.75)
  • New: Add View SQL command to View node.
  • Fixed:Does not show pragma command execute result(introduced in ver0.75)

    下载地址:这里

发布Sqlite Developer Preview 0.75

更新历史

  • Fixed: now sqlite system table can not be dropped.
  • Fixed: when created a database, the treeview was meshed.
  • New: update to
    support sqlite 3.25 analyze command.
  • Fixed: judge sql type and only show data grid for select sql.
  • Fixed: display order was not correct for the last item.
  • Update: update liveupdate
  • New: basic trigger edit function.
  • Update: now modified config is wrotten to file at once.

    下载地址:这里

Antlr的贪婪模式语法

.-noscript-blocked { border: 1px solid red !important; background: white url("chrome://noscript/skin/icon32.png") no-repeat left top !important; opacity: 0.6 !important; }

下面的规则是非贪婪模式的语法,它会匹配{之后的任意字符而不会匹配}符号,


CURLY_BLOCK_SCARF
: '{' (.)* '}'
;

 

要想让Antlr能够匹配},我们需要将规则改为

在DLL中使用Antlr

.-noscript-blocked { border: 1px solid red !important; background: white url("chrome://noscript/skin/icon32.png") no-repeat left top !important; opacity: 0.6 !important; }

新建一个Win32 DLL项目,设置如下

Delphi调用VC生成用于C程序调用的DLL的注意事项

在VC中可以Export DLL函数供C程序调用

#define PARSERDLL_API __declspec(dllexport)

extern "C" {
PARSERDLL_API int GetSqlType(LPCTSTR szSql);
}

Delphi要想调用这样的针对C输出的函数,不能使用stdcall的调用规范,而应使用cdecl的调用规范

如何include预编译头文件到antlr生成的cpp中

在Antlr生成cpp文件时,我们可能希望添加预编译头文件StdAfx.h到cpp文件中,标准的Header开关只能把头文件include到生成的头文件,而不能是cpp文件。

要想添加头文件到cpp中,需要使用antlr cpp生成器特殊控制开关关键字pre_include_cpp,示意如下
header "pre_include_cpp" {
#include "StdAfx.h"
}

anltr中如何声明变量

.-noscript-blocked { border: 1px solid red !important; background: white url("chrome://noscript/skin/icon32.png") no-repeat left top !important; opacity: 0.6 !important; }

column_ref_2[string& szTableName, string& szColumnName]
{
string s1,s2,s3, s4="";
}
:

c:id { s1=#c->getText();}
(PERIOD c1:id { s2=#c1->getText();}
(PERIOD c2:id { s3=#c2->getText();}
(PERIOD c3:id { s4=#c3->getText();}
)?)?)?
{
if (s2=="")
{

Antlr eclipse plugin

.-noscript-blocked { border: 1px solid red !important; background: white url("chrome://noscript/skin/icon32.png") no-repeat left top !important; opacity: 0.6 !important; }

Eclipse CDT 3.0发布了

.-noscript-blocked { border: 1px solid red !important; background: white url("chrome://noscript/skin/icon32.png") no-repeat left top !important; opacity: 0.6 !important; }Eclipse CDT 3.0发布了

同步内容