home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 5
/
FREESOFT.BIN
/
mopterm
/
led
/
led.plt
next >
Wrap
Text File
|
1992-08-19
|
16KB
|
701 lines
/*
LOG閲覧用オートパイロット
by MEET MHG02535
1991/08/11 ver1.0
1991/10/05 ver2.0
*/
%MainD {G:}; /*メインディレクトリ(最後の\は不要)*/
%TmpD {G:\TMP}; /*テンポラリファイル用ディレクトリ*/
%BatFile MainD|{\_mopbat.bat};
/*グローバル変数*/
var NEXT[8]; /*次の処理*/
var FORUM[7]; /*閲覧中フォーラム名*/
var ROOMNAME[8]; /*閲覧中会議室名*/
var LINENUM[5]; /*閲覧中の発言の発言一覧での位置*/
var SAYFILE[3]; /*発言を含むファイル*/
var SAY[7]; /*発言の先頭行*/
var SAYNO[10]; /*発言の最終行*/
var SAYNUM[3]; /*発言ナンバー*/
var ROOMNO[1]; /*閲覧中会議室ナンバー*/
var TMPNUM[10]; /*インデックスファイルにおける位置*/
var TMP[100];
var TMP1[100];
var FILENAME[80];
/*メモを全てクローズする*/
%CloseAllMemo
{
case(@mcheck != 0,
{Yes},{ loop({ mclose(2);
im(@mcheck != 0);
})
});
};
/*ファイルを探す。圧縮されている場合は、解凍。*/
%MeltFile
{ [FILENAME]
var RFILENAME[80];
case( @filechk(FILENAME),
{No}, { case( @filechk(TmpD | {\} | FILENAME),
{No}, { command({lha x LEDARC\}|ROOMNAME|{.LZH }
|TmpD|{\ }|FILENAME);
RFILENAME := TmpD | {\} | FILENAME; },
{Yes},{ RFILENAME := TmpD | {\} | FILENAME; }
); },
{Yes},{ RFILENAME := MainD | {\} | @head(FORUM, {_}) | {\} | FILENAME }
);
im( RFILENAME);
};
/*ファイルを探す2。圧縮されている場合は、解凍して、書庫から削除。*/
%MDFile
{ [FILENAME]
var RFILENAME[80];
case( @filechk(FILENAME),
{No}, { case( @filechk(TmpD | {\} | FILENAME),
{No}, { command({lha x LEDARC\}|ROOMNAME|{.LZH }
|TmpD|{\ }|FILENAME);
command({lha d LEDARC\}|ROOMNAME|{.LZH }
|FILENAME);
RFILENAME := TmpD | {\} | FILENAME; },
{Yes},{ RFILENAME := TmpD | {\} | FILENAME; }
); },
{Yes},{ RFILENAME := MainD | {\} | @head(FORUM, {_}) | {\} | FILENAME }
);
im( RFILENAME);
};
/*メイン*/
%Main
{
CloseAllMemo;
/*フォーラム一覧読み込み*/
mclear(1);
mread(MainD|{\main.inx},1);
NEXT := {forum};
/* NEXTの中身によって分岐 */
loop( {
case( NEXT,
{forum}, { NEXT := {}; forum; },
{room}, { NEXT := {}; room; },
{inx}, { NEXT := {}; inx; },
{say}, { NEXT := {}; say; },
{}, { CloseAllMemo; stop; }
);
im({Yes});
});
};
/*フォーラム一覧*/
%forum
{
CloseAllMemo;
mopen(1,0,21,639,459);
footnote({ EXIT },{b});
loop( { waitx(1000);
im(@xtype < 1 || (@xtype > 9 && @xtype < 201))
});
footnote({});
case( @im(@xtype) ,
{1}, { FORUM := @getchar( @head(@xline(0), { }), 1, 7);
setcdir(MainD | {\} | FORUM );
FORUM := @getchar( FORUM | {_______}, 1, 7);
roominit;
NEXT := {room}; }
);
};
/*会議室一覧読み込み*/
%roominit
{
CloseAllMemo;
CheckRoom;
mclear(2);
mread({roomlist.inx},2);
};
/* 足りないファイルがあれば自動制作 */
%CheckRoom
{
var Linenum[4];
%MakeIn2 {
var line[1000];
mclear(2);
%file @getchar(@memo(3, Linenum, 1), 1, 8) | {.in2};
footnote(file | {を、製作します});
fopen( @getchar(@memo(3, Linenum, 1), 1, 8) | {.inx} );
loop( {
line := @fread;
%roomno @getchar(line, 2, 2);
%sayno @getchar(line, 5, 3);
%commentno @getchar(line, 10, 3);
%handle @getchar(line, 23, 58);
line := @fread;
%filename @getchar(line, 10, 3);
%lineno @getchar(line, 15, 7);
%in2line roomno|{ }|sayno|{ }|commentno|{ }|handle|filename
|lineno|{\n};
loop({
case(@tail(line, {\n})={},
{No}, { line := @fread;
im({Yes}); } );
} );
madd( 2, in2line );
im( line <> {} );
} );
mwrite(file, 2);
fclose;
};
%MakeRoomlist {
footnote({会議室一覧を、製作します});
Linenum := 5;
write({roomlist.inx}, FORUM|{\n});
loop( {
var title[100];
%file @getchar(@memo(3, Linenum, 1), 1, 8) | {.in2};
%roomno @getchar(@read(file, 1, 1), 1, 2);
%firstline @read(file, 1, 1);
SAYFILE := @getchar(firstline, 70, 3);
ROOMNO := @getchar({123456789ABCDEFGHIJK},
@getchar(firstline, 1, 2),1);
ROOMNAME := FORUM | ROOMNO;
FILENAME := @MeltFile( FORUM|ROOMNO|{.}|SAYFILE );
case (@filechk(FILENAME),
{Yes},{ title := @getchar(@read(FILENAME, 1, 1), 3, 51)|
{ };
},
{No}, { title := { } }
);
%filename @getchar(@memo(3, Linenum, 1), 1, 8);
%inxline roomno|{ }|title|filename|{\n};
write({roomlist.inx}, inxline);
Linenum := Linenum + 1;
im(@getchar(@memo(3, Linenum, 1), 1, 1)<>{ });
} );
};
%CheckRoomlist {
var LINE[100];
%AddRoomlist {
var title[100];
%roomno @getchar(@read(file|{.in2}, 1, 1), 1, 2);
%firstline @read(file|{.in2}, 1, 1);
SAYFILE := @getchar(firstline, 70, 3);
ROOMNO := @getchar({123456789ABCDEFGHIJK}, roomno, 1);
ROOMNAME := FORUM | ROOMNO;
FILENAME := @MeltFile( FORUM|ROOMNO|{.}|SAYFILE );
case (@filechk(FILENAME),
{Yes},{ title := @getchar(@read(FILENAME, 1, 1), 3, 51)|
{ };
},
{No}, { title := { }; }
);
%inxline roomno|{ }|title|file|{\n};
footnote(file|{を会議室一覧を、追加します});
write({roomlist.inx}, inxline);
};
footnote({会議室一覧を、チェックします});
Linenum := 5;
var Linenum2[4];
loop( {
%file @getchar(@memo(3, Linenum, 1), 1, 8);
case(@getchar(@memo(3,Linenum, 1), 1, 1) = { },
{No}, { Linenum2 := 1;
var Flug[3];
loop( {
Flug := {Yes};
LINE := @memo(4, Linenum2, 1);
%filename @getchar(LINE, 72, 8);
case(LINE = {},
{No}, { case(filename = {},
{No}, { case(filename = file,
{Yes},{ Flug := {No} }
); }
); },
{Yes},{ case(file = {ROOMLIST},
{No},{AddRoomlist} );
Flug := {No}; }
);
Linenum2 := Linenum2 + 1;
im(Flug);
} );
im({Yes}); },
{Yes},{ im({No}); }
);
Linenum := Linenum + 1;
} );
};
mclear(3);
command({dir *.inx > }|TmpD|{\led_dir.tmp});
mread(TmpD|{\led_dir.tmp}, 3);
Linenum := 5;
loop( {
case(@getchar(@memo(3,Linenum, 1), 1, 1) = { },
{No}, { %file @getchar(@memo(3, Linenum, 1), 1, 8) | {.in2};
case(file = {ROOMLIST.in2} || @filechk(file) ,
{No}, { MakeIn2; } );
im({Yes}); },
{Yes},{ im({No}); }
);
Linenum := Linenum + 1;
} );
case(@filechk({roomlist.inx}),
{No}, { MakeRoomlist },
{Yes},{ mclear(4);
mread({roomlist.inx},4);
CheckRoomlist }
);
};
/* 会議室一覧モード */
%room
{
CloseAllMemo;
mopen(2,0,21,639,459);
footnote({GO F EXIT },{b});
loop( { waitx(1000);
im(@xtype < 1 || (@xtype > 9 && @xtype < 201))
});
footnote({});
case( @im(@xtype) ,
{2}, { ROOMNAME := @tail(@xline(0), { });
inxinit;
NEXT := {inx}; },
{201},{ NEXT := {forum};},
);
};
/*発言一覧読み込み*/
%inxinit
{
CloseAllMemo;
mclear(3);
mread(ROOMNAME|{.in2},3);
};
/*発言一覧のカット*/
%SetInx
{
var SAYFILE[3];
var FILENAME[80];
var LINENUM[8];
var title[100];
mclose(1);
footnote({会議室カット中 });
command({DEL }|ROOMNAME|{.bak});
command({RENAME }|ROOMNAME|{.in2 }|ROOMNAME|{.bak});
mclear(4);
mread(ROOMNAME|{.bak}, 4);
LINENUM := 1;
TMP := Elinenum;
loop( {
footnote(LINENUM | { } | Slinenum | { } | Elinenum );
case( LINENUM < Slinenum ,
{Yes},{ case( LINENUM + 100 < Slinenum ,
{Yes},{ write(ROOMNAME|{.in2},
@memo(4, LINENUM, 100) );
LINENUM := LINENUM + 100;
},
{No}, { write(ROOMNAME|{.in2},@memo(4,
LINENUM, Slinenum - LINENUM) );
LINENUM := Slinenum;
} );
}
);
case( LINENUM >= Slinenum && Elinenum > 0,
{Yes},{ case( Elinenum < 100 ,
{Yes},{ write(RNAME|{.in2},
@memo(4, LINENUM, Elinenum) );
LINENUM := LINENUM + Elinenum;
Elinenum := 0;
},
{No}, { write(RNAME|{.in2},
@memo(4, LINENUM, 100) );
LINENUM := LINENUM + 100;
Elinenum := Elinenum -100;
}
); }
);
case( Elinenum = 0,
{Yes},{ case( @memo(4, LINENUM, 1) = {},
{No}, { write(ROOMNAME|{.in2},
@memo(4, LINENUM, 100) );
LINENUM := LINENUM + 100;
}
); }
);
im( @memo(4, LINENUM, 1) != {} );
} );
command({DEL }|ROOMNAME|{.bak });
command({RENAME }|ROOMNAME|{.inx }|ROOMNAME|{.bak});
LINENUM := 1;
Elinenum := TMP;
loop( {
footnote(LINENUM | { } | Slinenum | { } | Elinenum );
case( LINENUM < Slinenum ,
{Yes},{ case( LINENUM + 100 < Slinenum ,
{Yes},{ write(ROOMNAME|{.inx},
@read(ROOMNAME|{.bak}, LINENUM, 100) );
LINENUM := LINENUM + 100;
},
{No}, { write(ROOMNAME|{.inx},@read(ROOMNAME|
{.bak},LINENUM, Slinenum - LINENUM) );
LINENUM := Slinenum;
}
); }
);
case( LINENUM >= Slinenum && Elinenum > 0,
{Yes},{ case( Elinenum < 100 ,
{Yes},{ write(RNAME|{.inx},@read(
ROOMNAME|{.bak}, LINENUM, Elinenum) );
LINENUM := LINENUM + Elinenum;
Elinenum := 0;
},
{No}, { write(RNAME|{.inx},@read(
ROOMNAME|{.bak}, LINENUM, 100) );
LINENUM := LINENUM + 100;
Elinenum := Elinenum -100;
}
); }
);
case( Elinenum = 0,
{Yes},{ case( @memo(4, LINENUM, 1) = {},
{No}, { write(ROOMNAME|{.inx},@read(ROOMNAME|
{.bak}, LINENUM, 100) );
LINENUM := LINENUM + 100;
}
);
}
);
im( @memo(4, LINENUM, 1) != {} );
});
LINENUM := Slinenum;
Elinenum := TMP;
TMP := {};
loop( { SAYFILE := @getchar(@memo(3,LINENUM,1), 70, 3);
FILENAME := ROOMNAME | {.} | SAYFILE;
footnote( @getchar(@memo(3,LINENUM,1), 4, 3) );
case ( SAYFILE = TMP ,
{No}, { FILENAME := @MDFile( FILENAME );
write(BatFile, {LHa m }| MainD | {\} |@head(FORUM,{_})|
{\LEDARC\} | RNAME | { } | FILENAME | {\n});
case ( LINENUM = Slinenum,
{Yes},{ TMP1 := @read(FILENAME, 1, 1);}
); },
{Yes},{ case ( LINENUM = Slinenum,
{Yes},{ TMP1 := @read(FILENAME, 1, 1);}
); }
);
TMP := SAYFILE;
LINENUM := LINENUM + 1;
im(LINENUM <= Elinenum);
} );
roominit;
};
%inxCut
{
var Slinenum[8];
var Elinenum[8];
var RNAME[8];
footnote({カットする先頭を指定してください});
loop( { waitx(1000);
im(@xtype != 3)
});
Slinenum := @xlinenum;
footnote({カットする最後を指定してください});
loop( { waitx(1000);
im(@xtype != 3)
});
Elinenum := @xlinenum;
case(Slinenum > Elinenum ,
{Yes},{ TMP := Slinenum;
Slinenum := Elinenum;
Elinenum := TMP; }
);
%StartNo @getchar(@memo(3,Slinenum, 1), 4, 3);
%EndNo @getchar(@memo(3,Elinenum, 1), 4, 3);
Elinenum := Elinenum - Slinenum + 1;
RNAME := @getchar(@input( {発言no.}|StartNo|{ からno.}|EndNo|
{ 迄をカットします\n Ok・・会議室名(八文字以内) Cancel・・空文字列})
|{________},1,8);
case( RNAME = {________},
{No},{ SetInx; NEXT := {room} }
);
};
/*発言一覧モード*/
%inx
{
CloseAllMemo;
mopen(3,0,21,639,459);
curline(LINENUM);
footnote({Go FGo RCut EXIT },{b});
loop( { waitx(1000);
im(@xtype < 1 || (@xtype > 9 && @xtype < 201))
});
footnote({});
case( @im(@xtype) ,
{3}, { LINENUM := @xlinenum;
sayinit;
NEXT := {say}; },
{201},{ NEXT := {forum};},
{202},{ NEXT := {room};},
{203},{ NEXT := {inx};
inxCut; }
);
};
/*発言読み込み*/
%sayinit
{
SAYNUM := @getchar(@memo(3,LINENUM,1), 4, 3);
SAYNO := @getchar(@memo(3,LINENUM,1), 70, 10);
SAY := @getchar(SAYNO, 4,5);
SAYFILE := @head(SAYNO, SAY);
SAYNO := @getchar(@memo(3,LINENUM + 1, 1), 73, 5);
ROOMNO := @getchar({123456789ABCDEFGHIJK},
@getchar(@memo(3,LINENUM, 1), 1, 2),1);
};
%say
{
CloseAllMemo;
mclear(4);
mclear(5);
FILENAME := @MeltFile( FORUM|ROOMNO|{.}|SAYFILE );
case(LINENUM < 3,
{Yes},{ madd(5, @memo(3, 0, 2 + LINENUM) ); },
{No}, { madd(5, @memo(3, LINENUM - 2, 5) ); }
);
case( @filechk(FILENAME),
{No}, { footnote({発言ファイル}|FILENAME|{が存在しません});
NEXT := {inx}; },
{Yes},{ Printsay; }
);
};
/* 発言モード */
%Printsay
{
case( SAYNO > SAY,
{Yes},{ madd(4, @read(FILENAME, SAY, SAYNO - SAY)); },
{No} ,{ madd(4, @read(FILENAME, SAY)); }
);
CloseAllMemo;
mopen(5,0, 21,639,140);
mclose(1);
mopen(4,0,141,639,459);
footnote({Go FGo RIndxNextBackコメント 元 次 前 EXIT },{b});
loop( { waitx(1000);
im(@xtype < 1 || (@xtype > 9 && @xtype < 201))
});
footnote({});
case( @im(@xtype) ,
{201},{ NEXT := {forum};},
{202},{ NEXT := {room};},
{203},{ NEXT := {inx};},
{204},{ LINENUM := LINENUM + 1;
case( @memo(3, LINENUM, 1) = {},
{Yes},{ LINENUM := LINENUM - 1;
NEXT := {inx}; },
{No} ,{ sayinit;
NEXT := {say}; }
);
},
{205},{ LINENUM := LINENUM - 1;
case( LINENUM < 1,
{Yes},{ LINENUM := LINENUM + 1;
NEXT := {inx}; },
{No} ,{ sayinit;
NEXT := {say}; }
);
},
{206},{ TMPNUM := LINENUM;
loop( { TMPNUM := TMPNUM + 1;
TMP := @getchar(@memo(3,TMPNUM,1), 8, 3);
case( TMP = SAYNUM || TMP = {} ,
{No}, { im({Yes});}
);
footnote(TMP | { } | TMP1);
} );
case( TMP = {},
{No} ,{ LINENUM := TMPNUM;
sayinit;
},
{Yes},{ footnote({コメントがありません});
CloseAllMemo;
} );
NEXT := {say};
},
{207},{ TMPNUM := LINENUM;
TMP := @getchar(@memo(3,TMPNUM,1), 8, 3);
loop( { TMPNUM := TMPNUM - 1;
TMP1 := @getchar(@memo(3,TMPNUM,1), 4, 3);
case( TMP = TMP1 || TMPNUM = 0 ,
{No}, { im({Yes});}
);
footnote(TMP | { } | TMP1);
} );
case( TMP != TMP1,
{No} ,{ LINENUM := TMPNUM;
sayinit;
},
{Yes},{ footnote({元の発言がありません});
CloseAllMemo;
}
);
NEXT := {say};
},
{208},{ TMPNUM := LINENUM;
TMP := @getchar(@memo(3,TMPNUM,1), 8, 3);
loop( { TMPNUM := TMPNUM + 1;
TMP1 := @getchar(@memo(3,TMPNUM,1), 8, 3);
case( TMP = TMP1 || TMP1 = {} || TMP = { },
{No}, { im({Yes});}
); }
footnote(TMP | { } | TMP1);
);
case( TMP ,
TMP1, { LINENUM := TMPNUM;
sayinit;
},
, { footnote({次のコメントはありません});
CloseAllMemo;
}
);
NEXT := {say};
},
{209},{ TMPNUM := LINENUM;
TMP := @getchar(@memo(3,TMPNUM,1), 8, 3);
loop( { TMPNUM := TMPNUM - 1;
TMP1 := @getchar(@memo(3,TMPNUM,1), 8, 3);
case( TMP = TMP1 || TMPNUM = 1 || TMP = { },
{No}, { im({Yes});}
); }
footnote(TMP | { } | TMP1);
);
case( TMP ,
TMP1, { LINENUM := TMPNUM;
sayinit;
},
, { footnote({前のコメントはありません});
CloseAllMemo;
}
);
NEXT := {say};
},
);
};
CloseAllMemo;
mclear(1);
madd(1,{a});
mopen(1,0,21,200,100);
CloseAllMemo;
mclear(2);
madd(2,{a});
mopen(2,0,21,200,100);
Main