[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Readable lctype.c
- From: saito yutaka <melody.pea@...>
- Date: Thu, 16 Feb 2012 00:08:38 +0900
Hello.
I modified lctype.c . I just added some comments.
Because I feel that it little hard to know what meaning each values in
luai_ctype_
so I wrote some information as comment for easy to read code.
I hope those comments helps someone who want to understand lua's source code.
Thanks
Yutaka.
/*
** $Id: lctype.c,v 1.11 2011/10/03 16:19:23 roberto Exp $
** 'ctype' functions for Lua
** See Copyright Notice in lua.h
*/
#define lctype_c
#define LUA_CORE
#include "lctype.h"
#if !LUA_USE_CTYPE/* { */
#include <limits.h>
/*
** Each bit information .
** +-----------+------+-------+-----------+---------+----------+
** | BIT7-BIT5 | BIT4 | BIT3 | BIT2 | BIT1 | BIT0 |
** +-----------+------+-------+-----------+---------+----------+
** | Not used | Hex | Space | Printable | Decimal | Alphabet |
** +-----------+------+-------+-----------+---------+----------+
*/
LUAI_DDEF const lu_byte luai_ctype_[UCHAR_MAX + 2] = {
0x00, /* EOZ */
/* ASCII control characters */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* NUL SOH STX ETX EOT ENQ ACK BEL */
0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, /* BS HT LF VT FF CR SO SI */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* DLE DC1 DC2 DC3 DC4 NAK SYN ETB */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* CAN EM SUB ESC FS GS RS US */
/* ASCII printable characters */
0x0c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, /* SP ! " # $ % & ' */
0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, /* ( ) * + , - . / */
0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, /* 0 1 2 3 4 5 6 7 */
0x16, 0x16, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, /* 8 9 : ; < = > ? */
0x04, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x05, /* @ A B C D E F G */
0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, /* H I J K L M N O */
0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, /* P Q R S T U V W */
0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x05, /* X Y Z [ \ ] ^ _ */
0x04, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x05, /* ` a b c d e f g */
0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, /* h i j k l m n o */
0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, /* p q r s t u v w */
0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x00, /* x y z { | } ~ DEL */
/* Extended ASCII codes */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* . . . . . . . . */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* . . . . . . . . */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* . . . . . . . . */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* . . . . . . . . */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* . . . . . . . . */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* . . . . . . . . */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* . . . . . . . . */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* . . . . . . . . */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* . . . . . . . . */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* . . . . . . . . */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* . . . . . . . . */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* . . . . . . . . */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* . . . . . . . . */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* . . . . . . . . */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* . . . . . . . . */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* . . . . . . . . */
};
#endif/* } */