Ruby源文件指引

本文介绍了Ruby语言核心及实用工具中各个源文件的功能与用途,包括类、错误处理、垃圾回收等核心组件,以及动态加载、正则表达式等实用工具,并列举了对应Ruby类的C源程序。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Ruby的一些源文件的用途:


Ruby语言核心:

class.c class相关API
error.c 错误相关API
eval.c eval 相关
gc.c 垃圾收集
object.c 对象系统
parse.y 解析
variable.c 常量,全局变量,类变量。
ruby.h ruby的主要宏和原型
intern.h ruby的C API的原型。intern是internal的略写

实用工具(util)
dln.c 动态载入
regex.c 正则表达式引擎
st.c hash table
util.c 基数变换,排序等的库

ruby 命令行程序
dmyext.c 扩展库的初始化例程
inits.c 核心和扩展库初始化的入口点。
main.c 命令入口点(libruby不需要)
ruby.c ruby命令的主要部分(libruby需要)
version.c ruby版本

C源程序对应的ruby类:

array.c class Array
bignum.c class Bignum
compar.c module Comparable
dir.c class Dir
enum.c module Enumerable
file.c class File
hash.c class Hash (实体st.c)
io.c class IO
marshal.c module Marshal
math.c module Math
numeric.c class Numeric、Integer、Fixnum、Float
pack.c Array#pack、String#unpack
prec.c module Precision
process.c module Process
random.c Kernel#srand()、rand()
range.c class Range
re.c class Regexp (实体regex.c)
signal.c module Signal
sprintf.c ruby 专用的sprintf()
string.c class String
struct.c class Struct
time.c class Time

<!-- comment these out if you want to see an example of custom fields, but remember to name the fields in the same way they are named here: 'imfeeling' (livejournal.com style), 'listening' and 'new_field' <p> <b></b> <br /> <b>:</b> <br /> <b></b>?</p> -->
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值