Newsgroups: fj.editor.emacs,fj.sources
Path: galaxy.trc.rwcp.or.jp!jaist-news!morioka
From: morioka@jaist.ac.jp (=?ISO-2022-JP?B?GyRCPGkyLBsoQiAbJEJDTkknGyhC?= /
 MORIOKA Tomohiko)
Subject: ol2
Content-Type: multipart/mixed; boundary="Multipart Fri Feb 25 15:06:26 1994"
Message-ID: <MORIOKA.94Feb25150626@is15e0s03.jaist.ac.jp>
Sender: news@jaist.ac.jp (News System Administrator)
Content-Transfer-Encoding: 7bit
Organization: JAIST, Hokuriku / =?ISO-2022-JP?B?GyRCS0xOJkBoQzwySjNYGyhC?=
 =?ISO-2022-JP?B?GyRCNTs9UUJnM1gxIUJnM1gbKEI=?=
Mime-Version: 1.0
Date: Fri, 25 Feb 1994 06:06:26 GMT
Dnas-Posting-Host: is15e0s03
Lines: 124
Xref: galaxy.trc.rwcp.or.jp fj.editor.emacs:4454 fj.sources:2924
X-originally-archived-at: http://galaxy.rwcp.or.jp/text/cgi-bin/newsarticle2?ng=fj.editor.emacs&nb=4454&hd=a
X-reformat-date: Mon, 18 Oct 2004 15:18:22 +0900
X-reformat-comment: Tabs were expanded into 4 column tabstops by the Galaxy's archiver. See http://katsu.watanabe.name/ancientfj/galaxy-format.html for more info.

--Multipart Fri Feb 25 15:06:26 1994
Content-Type: text/plain; charset=ISO-2022-JP


  ol2 $B$O(B Emacs $B$N(B outline-mode $B$NI8=`7A<0$N(B file $B$N3F@a$K@aHV9f$r?6$k(B
$B$?$a$N(B filter $B$G$9!#(B

  $BNc$($P!"(B

----------------------------------------------------------------------
* $B$O$8$a$K(B

** MIME $B$N#2$D$NB&LL(B

...

* MIME $B$NMxMQK!(B

...
----------------------------------------------------------------------

$B$H$$$&$h$&$J(B file $B$r(B

----------------------------------------------------------------------
$B#1(B $B$O$8$a$K(B

1.1 MIME $B$N#2$D$NB&LL(B

...

$B#2(B MIME $B$NMxMQK!(B

...
----------------------------------------------------------------------

$B$H$$$&Iw$KJQ49$7$^$9!#$3$l$K$h$j!"(Bplain2 $B$K$+$1$F(B LaTeX $B7A<0$KJQ49$9$k(B
$B$3$H$,$G$-$^$9!#(B

--Multipart Fri Feb 25 15:06:26 1994
Content-Type: application/octet-stream; name="ol2.c"; type=c
Content-Transfer-Encoding: 7bit

/*
 *   This program `ol2' is a converter
 * from GNU Emacs outline-mode style file to plain text file.
 *   This is a filter. So, input is `stdin', output is `stdout'.
 *
 * by MORIOKA Tomohiko, 1992
 *
 */

#include <stdio.h>

main()
{
    unsigned char  depth=0, offset=1;
    
    for(;;){
char str[256], *cp;
unsigned short  section[255];
unsigned char   d;
unsigned short  i;
unsigned short  code;

if(gets(str)==NULL) break;

for(d=0, cp=str; ;d++){
    if(*cp++!='*') break;
}
if(*--cp==' ') cp++;
if(d==0){
    puts(str);
}
else if(d==1){
    if(d>depth){
depth=d;
section[0]=0;
    }
    else if(d==depth){
section[0]++;
    }
    else{
depth=d;
section[0]++;
    }
    code=0xa3b0+section[0]+offset;
    printf("%c%c %s\n", code>>8,code&0xff, cp);
}
else if(d==depth){
    section[depth-1]++;
    for(i=0; i<depth-1; i++){
printf("%d.", section[i]+offset);
    }
    printf("%d %s\n", section[i]+offset, cp);
}
else if(d>depth){
    for(i=0; i<depth; i++){
printf("%d.", section[i]+offset);
    }
    for(; i<d-1; i++){
section[i]=0;
printf("%d.", section[i]+offset);
    }
    section[i]=0;
    printf("%d %s\n", section[i]+offset, cp);
    depth=d;
}
else{
    depth=d;
    section[depth-1]++;
    for(i=0; i<depth-1; i++){
printf("%d.", section[i]+offset);
    }
    printf("%d %s\n", section[i]+offset, cp);
}   
    }
}
--Multipart Fri Feb 25 15:06:26 1994
Content-Type: text/plain; charset=ISO-2022-JP

======$B!X?M$K$O$=$l$>$l0[$J$kL4$H$=$NJ}K!$,$"$C$FA3$k$Y$-$G$"$k!Y(B======
                     $B<i2,(B $BCNI'(B (MORIOKA Tomohiko)
                     Email: <morioka@jaist.ac.jp>
--Multipart Fri Feb 25 15:06:26 1994--
