Convert K&R definitions to ANSI C
This commit is contained in:
parent
787febbd07
commit
a2161ba1b0
45 changed files with 521 additions and 1073 deletions
114
sjrc2.c
114
sjrc2.c
|
|
@ -110,8 +110,8 @@ extern struct functbl funcs[];
|
|||
extern struct valtbl mode_val[], code_val[];
|
||||
|
||||
#define TOLOWER(c) (isupper(c) ? tolower(c) : (c))
|
||||
|
||||
sjset_code() {
|
||||
int sjset_code(void)
|
||||
{
|
||||
char* loc;
|
||||
|
||||
if(current_locale == LC_CTYPE_EUC) {
|
||||
|
|
@ -121,8 +121,8 @@ sjset_code() {
|
|||
} else
|
||||
user_euc = 0;
|
||||
}
|
||||
|
||||
sjrc_init() {
|
||||
int sjrc_init(void)
|
||||
{
|
||||
clear_del();
|
||||
clear_key();
|
||||
intr_code = 0x03;
|
||||
|
|
@ -140,8 +140,8 @@ sjrc_init() {
|
|||
}
|
||||
dict_num = 0;
|
||||
}
|
||||
|
||||
getsjrc() {
|
||||
int getsjrc(void)
|
||||
{
|
||||
char* p;
|
||||
char* getenv();
|
||||
|
||||
|
|
@ -170,8 +170,7 @@ getsjrc() {
|
|||
|
||||
RCfile[0] = '\0';
|
||||
}
|
||||
|
||||
setrc(file) char* file;
|
||||
int setrc(char * file)
|
||||
{
|
||||
wchar16_t* p;
|
||||
char line[MAXLINE];
|
||||
|
|
@ -202,8 +201,7 @@ setrc(file) char* file;
|
|||
fclose(fd);
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
getsjrk(erase) int erase;
|
||||
int getsjrk(int erase)
|
||||
{
|
||||
char* p;
|
||||
int i;
|
||||
|
|
@ -250,10 +248,7 @@ getsjrk(erase) int erase;
|
|||
if(!oasys)
|
||||
mkkigou();
|
||||
}
|
||||
|
||||
match(s1, s2)
|
||||
wchar16_t* s1,
|
||||
*s2;
|
||||
int match(wchar16_t * s1, wchar16_t * s2)
|
||||
{
|
||||
wchar16_t c1, c2;
|
||||
|
||||
|
|
@ -267,9 +262,7 @@ match(s1, s2)
|
|||
}
|
||||
return (1);
|
||||
}
|
||||
|
||||
getword(s, word) unsigned char* s;
|
||||
struct wordent word[];
|
||||
int getword(unsigned char * s, struct wordent word[])
|
||||
{
|
||||
unsigned char c;
|
||||
wchar16_t* w;
|
||||
|
|
@ -377,40 +370,35 @@ struct wordent word[];
|
|||
word[++wcount].word_str[0] = '\0';
|
||||
return (wcount);
|
||||
}
|
||||
|
||||
IsTerminator(c) unsigned char c;
|
||||
int IsTerminator(unsigned char c)
|
||||
{
|
||||
if(c == '\n')
|
||||
return (1);
|
||||
else
|
||||
return (0);
|
||||
}
|
||||
|
||||
isTerminator(c) unsigned char c;
|
||||
int isTerminator(unsigned char c)
|
||||
{
|
||||
if(c == '#')
|
||||
return (1);
|
||||
else
|
||||
return (0);
|
||||
}
|
||||
|
||||
IsEscape(c) unsigned char c;
|
||||
int IsEscape(unsigned char c)
|
||||
{
|
||||
if(c == '\\')
|
||||
return (1);
|
||||
else
|
||||
return (0);
|
||||
}
|
||||
|
||||
IsDelimitor(c) unsigned char c;
|
||||
int IsDelimitor(unsigned char c)
|
||||
{
|
||||
if(c == ' ' || c == '\t' || c == '.')
|
||||
return (1);
|
||||
else
|
||||
return (0);
|
||||
}
|
||||
|
||||
set_forkshell(word) struct wordent word[];
|
||||
int set_forkshell(struct wordent word[])
|
||||
{
|
||||
if(word[1].word_str[0] != '\0' && shellprog[0] == '\0') {
|
||||
/*
|
||||
|
|
@ -421,8 +409,7 @@ set_forkshell(word) struct wordent word[];
|
|||
shell_flag++;
|
||||
}
|
||||
}
|
||||
|
||||
set_intr(word) struct wordent word[];
|
||||
int set_intr(struct wordent word[])
|
||||
{
|
||||
int c;
|
||||
|
||||
|
|
@ -430,8 +417,7 @@ set_intr(word) struct wordent word[];
|
|||
if((c = eval_key(word[1].word_str)) != -1)
|
||||
intr_code = c;
|
||||
}
|
||||
|
||||
set_delkey(word) struct wordent word[];
|
||||
int set_delkey(struct wordent word[])
|
||||
{
|
||||
int c;
|
||||
|
||||
|
|
@ -439,16 +425,14 @@ set_delkey(word) struct wordent word[];
|
|||
if((c = eval_key(word[1].word_str)) != -1)
|
||||
set_del(c);
|
||||
}
|
||||
|
||||
isintr(c) unsigned char c;
|
||||
int isintr(unsigned char c)
|
||||
{
|
||||
if(c == intr_code)
|
||||
return (1);
|
||||
else
|
||||
return (0);
|
||||
}
|
||||
|
||||
set_goto(word) struct wordent word[];
|
||||
int set_goto(struct wordent word[])
|
||||
{
|
||||
int c;
|
||||
|
||||
|
|
@ -456,8 +440,7 @@ set_goto(word) struct wordent word[];
|
|||
if((c = eval_key(word[1].word_str)) != -1)
|
||||
goto_code[goto_num++] = c;
|
||||
}
|
||||
|
||||
IsGoto(c) unsigned char c;
|
||||
int IsGoto(unsigned char c)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
@ -467,8 +450,7 @@ IsGoto(c) unsigned char c;
|
|||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
set_trap(word) struct wordent word[];
|
||||
int set_trap(struct wordent word[])
|
||||
{
|
||||
int c;
|
||||
|
||||
|
|
@ -476,8 +458,7 @@ set_trap(word) struct wordent word[];
|
|||
if((c = eval_key(word[1].word_str)) != -1)
|
||||
trap_code[trap_num++] = c;
|
||||
}
|
||||
|
||||
IsTrap(c) unsigned char c;
|
||||
int IsTrap(unsigned char c)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
@ -487,8 +468,7 @@ IsTrap(c) unsigned char c;
|
|||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
mode_key(mode) int mode;
|
||||
int mode_key(int mode)
|
||||
{
|
||||
switch(mode) {
|
||||
case MODE_HALPHA:
|
||||
|
|
@ -511,8 +491,7 @@ mode_key(mode) int mode;
|
|||
}
|
||||
|
||||
int Direct = 0;
|
||||
|
||||
set_init_mode(word) struct wordent word[];
|
||||
int set_init_mode(struct wordent word[])
|
||||
{
|
||||
Conversion* cv;
|
||||
int i, j;
|
||||
|
|
@ -539,16 +518,14 @@ set_init_mode(word) struct wordent word[];
|
|||
p = word[++j].word_str;
|
||||
}
|
||||
}
|
||||
|
||||
set_helpmenu(word) struct wordent word[];
|
||||
int set_helpmenu(struct wordent word[])
|
||||
{
|
||||
if(match(word[1].word_str, WCOff))
|
||||
HHlevel = Hlevel = 1;
|
||||
else if(match(word[1].word_str, WCOn))
|
||||
HHlevel = Hlevel = 2;
|
||||
}
|
||||
|
||||
set_defcode(word) struct wordent word[];
|
||||
int set_defcode(struct wordent word[])
|
||||
{
|
||||
wchar16_t* p;
|
||||
int i;
|
||||
|
|
@ -561,8 +538,7 @@ set_defcode(word) struct wordent word[];
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
set_muhenkan(word) struct wordent word[];
|
||||
int set_muhenkan(struct wordent word[])
|
||||
{
|
||||
int i;
|
||||
wchar16_t* p;
|
||||
|
|
@ -575,8 +551,7 @@ set_muhenkan(word) struct wordent word[];
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
set_muedit(word) struct wordent word[];
|
||||
int set_muedit(struct wordent word[])
|
||||
{
|
||||
int i;
|
||||
wchar16_t* p;
|
||||
|
|
@ -589,33 +564,30 @@ set_muedit(word) struct wordent word[];
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
set_m_toggle(word) struct wordent word[];
|
||||
int set_m_toggle(struct wordent word[])
|
||||
{
|
||||
if(match(word[1].word_str, WCOn))
|
||||
muhenkan_toggle = 1;
|
||||
if(match(word[1].word_str, WCOff))
|
||||
muhenkan_toggle = 0;
|
||||
}
|
||||
|
||||
set_silent(word) struct wordent word[];
|
||||
int set_silent(struct wordent word[])
|
||||
{
|
||||
vflag = 0;
|
||||
}
|
||||
|
||||
set_bstudy(word) struct wordent word[];
|
||||
int set_bstudy(struct wordent word[])
|
||||
{
|
||||
if(match(word[1].word_str, WCOn))
|
||||
bstudy = 1;
|
||||
if(match(word[1].word_str, WCOff))
|
||||
bstudy = 0;
|
||||
}
|
||||
|
||||
is_bstudy() {
|
||||
int is_bstudy(void)
|
||||
{
|
||||
return (bstudy);
|
||||
}
|
||||
|
||||
eval_muhenkan() {
|
||||
int eval_muhenkan(void)
|
||||
{
|
||||
Conversion* cv;
|
||||
|
||||
cv = GetConversion();
|
||||
|
|
@ -624,12 +596,11 @@ eval_muhenkan() {
|
|||
else
|
||||
return (def_muhenkan);
|
||||
}
|
||||
|
||||
value_muhenkan() {
|
||||
int value_muhenkan(void)
|
||||
{
|
||||
return (def_muedit);
|
||||
}
|
||||
|
||||
set_guide(word) struct wordent word[];
|
||||
int set_guide(struct wordent word[])
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
@ -709,16 +680,14 @@ set_guide(word) struct wordent word[];
|
|||
WCGmode = guide_function;
|
||||
}
|
||||
}
|
||||
|
||||
set_flush_conversion(word) struct wordent word[];
|
||||
int set_flush_conversion(struct wordent word[])
|
||||
{
|
||||
if(match(word[1].word_str, WCOn))
|
||||
flush_conversion = 1;
|
||||
if(match(word[1].word_str, WCOff))
|
||||
flush_conversion = 0;
|
||||
}
|
||||
|
||||
set_server(word) struct wordent word[];
|
||||
int set_server(struct wordent word[])
|
||||
{
|
||||
int i, j, size;
|
||||
char* p;
|
||||
|
|
@ -752,8 +721,7 @@ set_server(word) struct wordent word[];
|
|||
}
|
||||
|
||||
#define DICT_SUFFIX ".dic"
|
||||
|
||||
set_dict(word) struct wordent word[];
|
||||
int set_dict(struct wordent word[])
|
||||
{
|
||||
int i, j, size, suffix_len;
|
||||
char* p;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue