2012-12-04 21:36:19 +04: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 11:38:07 +04:00
|
|
|
defs = File.join(File.dirname(File.dirname(erb.filename)), "defs/id.def")
|
2022-09-08 09:25:05 +03:00
|
|
|
ids = eval(File.read(defs), nil, defs)
|
2015-11-05 07:04:00 +03:00
|
|
|
ops = ids[:token_op].uniq {|id, op, token| token && op}
|
2012-12-04 21:36:19 +04:00
|
|
|
%>
|
2015-11-05 07:04:00 +03: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 21:36:19 +04:00
|
|
|
static void
|
|
|
|
Init_id(void)
|
|
|
|
{
|
|
|
|
rb_encoding *enc = rb_usascii_encoding();
|
|
|
|
|
2012-12-21 11:38:03 +04:00
|
|
|
% ids[:predefined].each do |token, name|
|
2012-12-04 21:36:19 +04:00
|
|
|
REGISTER_SYMID(id<%=token%>, "<%=name%>");
|
|
|
|
% end
|
|
|
|
}
|