2012-12-04 12:36:19 -05:00
|
|
|
%# -*- c -*-
|
|
|
|
/* DO NOT EDIT THIS FILE DIRECTLY */
|
|
|
|
/**********************************************************************
|
|
|
|
|
|
|
|
id.c -
|
|
|
|
|
|
|
|
$Author$
|
|
|
|
created at: Wed Dec 5 02:36:10 2012
|
|
|
|
|
|
|
|
Copyright (C) 2004-2007 Koichi Sasada
|
|
|
|
|
|
|
|
**********************************************************************/
|
|
|
|
<%
|
2012-12-21 02:38:07 -05:00
|
|
|
defs = File.join(File.dirname(File.dirname(erb.filename)), "defs/id.def")
|
2012-12-21 02:38:03 -05:00
|
|
|
ids = eval(File.read(defs), binding, defs)
|
2015-11-04 23:04:00 -05:00
|
|
|
ops = ids[:token_op].uniq {|id, op, token| token && op}
|
2012-12-04 12:36:19 -05:00
|
|
|
%>
|
2015-11-04 23:04:00 -05:00
|
|
|
% ops.each do |_id, _op, token|
|
|
|
|
% next unless token
|
|
|
|
#define t<%=token%> RUBY_TOKEN(<%=token%>)
|
|
|
|
% end
|
|
|
|
|
|
|
|
static const struct {
|
|
|
|
unsigned short token;
|
|
|
|
const char name[3], term;
|
|
|
|
} op_tbl[] = {
|
|
|
|
% ops.each do |_id, op, token|
|
|
|
|
% next unless token
|
|
|
|
{t<%=token%>, "<%=op%>"},
|
|
|
|
% end
|
|
|
|
};
|
|
|
|
|
2012-12-04 12:36:19 -05:00
|
|
|
static void
|
|
|
|
Init_id(void)
|
|
|
|
{
|
|
|
|
rb_encoding *enc = rb_usascii_encoding();
|
|
|
|
|
2012-12-21 02:38:03 -05:00
|
|
|
% ids[:predefined].each do |token, name|
|
2012-12-04 12:36:19 -05:00
|
|
|
REGISTER_SYMID(id<%=token%>, "<%=name%>");
|
|
|
|
% end
|
|
|
|
}
|