ruby/enc/encinit.c.erb

42 строки
986 B
Plaintext

/* Automatically generated from <%= erb.filename %>
* Do not edit<%# directly%>.
*/
/* Copyright 2012 Google Inc. Some Rights Reserved.
* Author: yugui@google.com (Yugui Sonoda)
*/
#include <stdio.h>
#include "ruby.h"
#define init(func, name) { \
extern void func(void); \
ruby_init_ext(name, func); \
}
#define init_enc(name) init(Init_##name, "enc/"#name".so")
#define init_trans(name) init(Init_trans_##name, "enc/trans/"#name".so")
#define provide(func, name) { \
extern void Init_##func(void); \
Init_##func(); \
rb_provide(name".so"); \
}
void ruby_init_ext(const char *name, void (*init)(void));
void rb_provide(const char *feature);
void
Init_enc(void)
{
provide(encdb, "encdb");
% ENCS.each do |enc|
% next if enc == 'encdb'
init_enc(<%= enc %>);
% end
provide(transdb, "trans/transdb");
% TRANS.each do |trans|
% next if trans == 'trans/transdb'
init_trans(<%= File.basename trans %>);
% end
}
<%# vim: set ft=eruby sw=2 : -%>