home *** CD-ROM | disk | FTP | other *** search
- /*{{{}}}*/
- /*{{{ #includes*/
- #include <string.h>
- #include <stdlib.h>
- #include <sys/types.h>
- #ifndef NO_GETOPT_H
- # include <getopt.h>
- #endif
- #include <stdio.h>
- #include <signal.h>
-
- #define VIEW_MAIN_C
-
- #include <h/os.h>
- #define I_SET_C
- #define BIND_CONST
- #include <h/keys.h>
-
- #include "viewrc.h"
-
- #define I_RC_CHECK
- #define CODE_LG_ARRAY
-
- #include <h/rcformat.h>
- #include <h/envvar_str.h>
- #include <h/codelg.h>
- #include <h/getmsg.h>
- #include <lib/ori_rc_lib.h>
- /*}}} */
-
- /*{{{ variables*/
- FILE *rc;
- int info=0;
- char const ctrl_c[]=CTRL_CHARS;
- off_t vrc_off=0;
- boolean misc_out=False;
- boolean macro_out=False;
- boolean ktb_out=False;
- boolean ref_out=False;
- /*}}} */
-
- /*{{{ vrc_get_c*/
- #define vrc_get_c(f) (vrc_off+=rc_c_lg,rc_get_c(f))
- /*}}} */
- /*{{{ vrc_get_w*/
- #define vrc_get_w(f) (vrc_off+=rc_w_lg,rc_get_w(f))
- /*}}} */
- /*{{{ vrc_gets*/
- char *vrc_gets(char *buff,int lg,FILE *f)
- {
- char *ret;
-
- ret=fgets(buff,lg,f);
- vrc_off+=strlen(buff);
-
- return(ret);
- }
- /*}}} */
- /*{{{ vrc_ftell*/
- #define vrc_ftell(f) (((f)==stdin)?vrc_off:ftell(f))
- /*}}} */
- /*{{{ error_abort*/
- void error_abort(void)
- { fprintf(stderr,F_CRASH,vrc_ftell(rc));
- exit(1);
- }
- /*}}} */
- /*{{{ decode_mac*/
- /*{{{ get_dec*/
- char const *get_dec(TOKEN const x)
- {
- if (x>=O_NOP && x<=O_EXE_MACRO)
- return(dec[x-O_NOP]);
- else if (x>O_EXE_MACRO)
- { static char s[32];
-
- sprintf(s,"O_CALL_FIX %d",x-O_EXE_MACRO);
- return(s);
- }
- else
- return(M_UNKNOWN);
- }
- /*}}} */
-
- int decode_mac(FILE *f,int lg)
- {
- int pc=0;
- TOKEN x;
- int dopc=1;
-
- while (lg) {
- /*{{{ show each statement*/
- x=vrc_get_w(f);
- lg--;
- if (x==EOF)
- return(1);
- else if (x<O_NOP) {
- /*{{{ normal chars*/
- if (dopc) {
- /*{{{ with pc*/
- if (macro_out)
- if (x>=' ')
- printf(F_NORM_PC,pc,(char) x);
- else
- printf(F_NORM,pc,x);
- dopc=0;
- /*}}} */
- } else {
- /*{{{ without pc*/
- if (macro_out)
- if (x>=' ')
- printf(F_CHAR,(char) x);
- else
- printf(F_DIGIT,x);
- /*}}} */
- }
- pc++;
- /*}}} */
- } else {
- /*{{{ opcodes*/
- COM_TYPES t;
-
- /*{{{ maybe end string in last line*/
- if (!dopc)
- { if (macro_out)
- printf(M_END_ST);
- dopc=1;
- }
- /*}}} */
- /*{{{ get commandtyp*/
- if (x<O_NOP || x>O_EXE_MACRO)
- t=COM;
- else
- t=cmd_type[x-O_NOP];
- /*}}} */
- switch (t) {
- /*{{{ two int args*/
- case COM_II: {
- int x1=vrc_get_w(rc);
- int x2=vrc_get_w(rc);
-
- lg-=2;
- if (macro_out)
- printf(F_OP_2_INT,pc,get_dec(x),x1,x2);
- pc+=3;
- break;
- }
- /*}}} */
- /*{{{ one int arg*/
- case COM_I:
- { int a1;
-
- lg--;
- a1=vrc_get_w(rc);
- if (macro_out)
- printf(F_OP_1_INT,pc,get_dec(x),a1);
- pc+=2;
- break;
- }
- /*}}} */
- /*{{{ one char-argument*/
- case COM_C: {
- int x1=vrc_get_w(rc);
-
- lg--;
- if (macro_out)
- if (x1>=' ')
- printf(F_OP_CHAR,pc,get_dec(x),x1,x1);
- else
- printf(F_OP_CODE,pc,get_dec(x),x1,ctrl_c[x1]);
- pc+=2;
- break;
- }
- /*}}} */
- /*{{{ 0/1/2 int + prompt*/
- case COM_IIP:
- case COM_IP:
- case COM_P: {
- if (t==COM_IIP)
- /*{{{ show cmd + 2 ints*/
- { int x1,x2;
-
- x1=vrc_get_w(rc);
- x2=vrc_get_w(rc);
- lg-=2;
- pc+=3;
- if (macro_out)
- printf(F_OP_IIP,pc,get_dec(x),x1,x2);
- }
- /*}}} */
- else if (t==COM_IP)
- /*{{{ show cmd + int*/
- { int a1;
-
-
- lg--;
- a1=vrc_get_w(rc);
- if (macro_out)
- printf(F_PROMPT_START,pc,get_dec(x),a1);
- pc+=2;
- }
- /*}}} */
- else
- /*{{{ show cmd*/
- { if (macro_out)
- printf(F_EXIT_START,pc,get_dec(x));
- pc++;
- }
- /*}}} */
- for (;;)
- /*{{{ show one item of prompt, break on M_END_MACRO or macro/file end*/
- { if (lg)
- /*{{{ get token from macro*/
- { lg--;
- x=vrc_get_w(rc);
- }
- /*}}} */
- else
- /*{{{ break, M_END comes from auto-end!*/
- { if (macro_out)
- printf(">\n");
- break;
- }
- /*}}} */
- if (x==M_END_MACRO)
- /*{{{ show and break*/
- { pc++;
- if (macro_out)
- printf(F_END_MACRO,get_dec(M_END_MACRO));
- break;
- }
- /*}}} */
- else if (x==EOF)
- /*{{{ break, error*/
- break;
- /*}}} */
- else if (x<O_NOP && x>=0)
- /*{{{ show char*/
- { if (macro_out)
- printf(F_CHAR,x);
- }
- /*}}} */
- else if (x<0)
- /*{{{ show message*/
- { ++x;
- if (macro_out)
- printf(F_MSG,-x+1,-x>=MSG_ARG_FORMAT?"":msg_list[-x]);
- }
- /*}}} */
- else if (x==M_INT_STRING)
- /*{{{ counter*/
- { int a1;
-
- lg--;
- a1=vrc_get_w(rc);
- if (macro_out)
- printf(F_COUNTER,a1);
- pc++;
- }
- /*}}} */
- else
- /*{{{ hope it was a history*/
- { int a1;
-
- lg--;
- a1=vrc_get_w(rc);
- if (macro_out)
- printf(F_HIST,a1);
- pc++;
- }
- /*}}} */
- pc++;
- }
- /*}}} */
- break;
- }
- /*}}} */
- /*{{{ adress*/
- case COM_A: {
- int ad=vrc_get_w(rc);
-
- if (macro_out)
- printf(F_OP_ADRESS,pc,get_dec(x),ad,pc+2+ad);
- lg--;
- pc+=2;
- break;
- }
- /*}}} */
- /*{{{ else only command*/
- case COM:
- if (macro_out)
- if (x>O_EXE_MACRO)
- printf(F_OP_1_INT,pc,"O_CALL_FIX",x-O_EXE_MACRO);
- else
- switch(x)
- { CASES_M_CALL
- printf(F_OP_ADRESS,pc,get_dec(x),x-M_CALL_0,pc+1+x-M_CALL_0);
- break;
- CASES_M_JMP
- printf(F_OP_ADRESS,pc,get_dec(x),x-M_JMP_0,pc+1+x-M_JMP_0);
- break;
- CASES_M_JMP_TRUE
- printf(F_OP_ADRESS,pc,get_dec(x),x-M_JMP_TRUE_0,pc+1+x-M_JMP_TRUE_0);
- break;
- CASES_M_JMP_FALSE
- printf(F_OP_ADRESS,pc,get_dec(x),x-M_JMP_FALSE_0,pc+1+x-M_JMP_FALSE_0);
- break;
- default:
- printf(F_OP,pc,get_dec(x));
- break;
- }
- pc+=1;
- break;
- /*}}} */
- }
- /*}}} */
- }
- /*}}} */
- }
- /*{{{ maybe end string in previous line*/
- if (macro_out)
- if (!dopc)
- printf(M_END_ST);
- /*}}} */
- /*{{{ automatic M_END_MACRO (generated in origami when reading rc)*/
- if (macro_out)
- printf(F_AUTO_END,pc,get_dec(M_END_MACRO));
- /*}}} */
- return(0);
- }
- /*}}} */
-
- /*{{{ main*/
- int main(int argc, char *argv[])
- {
- int mult=0;
-
- /*{{{ parse arguments*/
- { int c;
-
- while ((c=getopt(argc,argv,"fikmr"))!=EOF)
- switch (c)
- {
- /*{{{ f*/
- case 'f': macro_out=True;break;
- /*}}} */
- /*{{{ i*/
- case 'i': info=1;break;
- /*}}} */
- /*{{{ k*/
- case 'k': ktb_out=True;break;
- /*}}} */
- /*{{{ m*/
- case 'm': misc_out=True;break;
- /*}}} */
- /*{{{ r*/
- case 'r': ref_out=True;break;
- /*}}} */
- case 'h':
- default:
- printf(M_USAGE);
- exit(0);
- }
- if (!ktb_out && !macro_out && !misc_out && !ref_out)
- ktb_out=macro_out=misc_out=ref_out=True;
- }
- /*}}} */
- if (info)
- show_help();
- if (optind<(argc-1))
- mult=1;
- signal(SIGSEGV,(void(*)())error_abort);
- do
- /*{{{ handle one rc-file*/
- { char const * rcfile;
-
- if (optind==argc)
- rc=stdin;
- else if (!(rc=fopen(rcfile=argv[optind++],(char*)"rb")))
- { fprintf(stderr,F_NO_RC,rcfile);exit(1); }
- if (mult)
- printf("%s %s\n",fo,rcfile);
- /*{{{ scan rc-file*/
- { int input;
- int macsize=0;
- int mloadsize=0;
- long int f_pos;
- int bind_const[RCC_SIZE];
-
- ktb_count= -1;
- f_pos=vrc_ftell(rc);
- printf(F_CHECK,f_pos,vrc_get_w(rc),RC_CHECK);
- f_pos=vrc_ftell(rc);
- while (((input=vrc_get_c(rc))!=RC_ENDE)&&(input!=RC_BIND))
- /*{{{ handle all rc-commands*/
- { if (input==RC_DEFKEY && ktb_count>0)
- /*{{{ keydef*/
- { int nodes;
-
- /*{{{ decode and print table header with open fold*/
- { char kname[NAME_LG+1];
- char mark_str[1024];
-
- rc_get_s(rc,kname,NAME_LG);
- nodes=vrc_get_w(rc);
- /*{{{ read marks*/
- { int i;
-
- for (i=0,mark_str[0]='\0';i<ktb_count;i++)
- { char b[16];
-
- sprintf(b," %d",rc_get_w(rc));
- if (strlen(mark_str)<1000)
- strcat(mark_str,b);
- }
- }
- /*}}} */
- if (ktb_out)
- printf
- ( F_KEY_HEAD,
- fo,
- f_pos,
- *kname?kname:"default",
- mark_str,
- nodes
- );
- }
- /*}}} */
- /*{{{ decode the tablenodes with close fold*/
- { int no;
-
- for (no=0;nodes--;)
- { KEY k;
- int prt_key;
- char string[11];
- int co;
- int of1;
- int of2;
-
- set_key_data(&k,rc);
- if (ktb_out)
- {
- /*{{{ set command value*/
- co=key_code(&k);
- if (key_far_next(&k))
- co=0;
- /*}}} */
- /*{{{ get pointer id's*/
- if (key_next_ptr(&k))
- of1=no+(key_next_ptr(&k)-&k);
- else
- of1= -1;
- if (key_level_ptr(&k))
- of2=no+(key_level_ptr(&k)-&k);
- else
- of2= -1;
- /*}}} */
- /*{{{ print values of the keytabnode*/
- prt_key=k.key;
- if (k.flags&MAGIC_KEY)
- { strcpy(string,"all");
- prt_key= -1;
- }
- else if (prt_key==127)
- strcpy(string,"DEL");
- else if (prt_key>(unsigned char)127)
- sprintf(string,"%.3X",prt_key);
- else if (prt_key<(unsigned char)' ')
- { string[0]='C';
- string[1]='-';
- string[2]=ctrl_c[prt_key];
- string[4]='\0';
- }
- else
- sprintf(string,"%c ",prt_key);
- printf(F_NODE_VALUE,no,prt_key,string,of1,of2,co);
- no++;
- /*}}} */
- /*{{{ maybe print coded command*/
- if (key_far_next(&k))
- printf(M_FAR_NEXT);
- else if (!co)
- printf(M_NEWLINE);
- else if (co==keytabknb)
- printf(F_KNB_NODE,co);
- else if (co==127)
- printf(M_DEL_NODE,co);
- else if (co>=O_NOP)
- printf(M_COM_NODE,co,get_dec(co));
- else if (co>=' ')
- printf(M_CODE_NODE,co,co);
- else
- printf(M_CTRL_NODE,co,ctrl_c[co]);
- /*}}} */
- }
- }
- if (ktb_out)
- printf(F_CLOSE,fc);
- }
- /*}}} */
- }
- /*}}} */
- else
- /*{{{ others*/
- { switch (input) {
- /*{{{ constants*/
- case RC_CONST:
- { int i;
-
- for (i=0;i<RCC_SIZE;i++)
- bind_const[i]=vrc_get_w(rc);
- if (misc_out)
- { printf(F_CONST,fo,f_pos);
- /*{{{ sizes*/
- printf(F_MACS,f_pos+i_m_count*rc_w_lg,mac_count);
- printf(F_INTS,f_pos+i_v_count*rc_w_lg,var_count);
- printf(F_KTBS,f_pos+i_k_count*rc_w_lg,ktb_count);
- /*}}} */
- /*{{{ std vars*/
- printf(F_S1_VAR,fo,f_pos+i_v_cur_lev*rc_w_lg);
- printf
- ( F_S2_VAR,
- var_scr_w,
- var_off_w,
- var_scr_h,
- var_off_h,
- var_cur_lev,
- var_ocl_arg,
- var_file_no,
- var_us_buff,
- var_cu_buff,
- var_cu_b_id,
- var_m_edit,
- var_mod_beh,
- var_key_count,
- var_path,
- var_dired
- );
- printf(F_CLOSE,fc);
- /*}}} */
- /*{{{ mouse vars*/
- printf(F_M_V1,fo,f_pos+i_v_m_x*rc_w_lg);
- printf
- ( F_M_V2,
- var_m_x,
- var_m_y,
- var_m_gy,
- var_m_out,
- var_m_but,
- var_m_buff
- );
- printf(F_CLOSE,fc);
- /*}}} */
- /*{{{ switches*/
- if (var_notitle) printf(F_STAT,f_pos+i_v_notitle*rc_w_lg);
- if (arg_list) printf(F_F_LIST,f_pos+i_arg_list*rc_w_lg);
- /*}}} */
- /*{{{ specials*/
- if (general_abort_key!=255)
- /*{{{ abort*/
- printf(F_BREAK,
- f_pos+i_general_abort_key*rc_w_lg,
- general_abort_key,
- (general_abort_key>=' ' ? "" : "C-"),
- (general_abort_key>=' ' ? general_abort_key : ctrl_c[general_abort_key]));
- /*}}} */
- if (comma) printf(F_MODE_LIM,f_pos+i_comma*rc_w_lg,comma);
- if (eoln_str) printf(F_LINE_LIM,f_pos+i_lineend*rc_w_lg,eoln_str);
- if (soln_str) printf(F_SHIFT_MARK,f_pos+i_linestart*rc_w_lg,soln_str);
- /*}}} */
- /*{{{ auto_macros*/
- if (auto_macro)
- printf(F_A_MACRO,f_pos+i_auto_macro*rc_w_lg,auto_macro);
- if (abort_macro)
- printf(F_AB_MACRO,f_pos+i_abort_macro*rc_w_lg,abort_macro);
- if (pin_macro)
- printf(F_PI_MACRO,f_pos+i_pin_macro*rc_w_lg,pin_macro);
- if (pout_macro)
- printf(F_PO_MACRO,f_pos+i_pout_macro*rc_w_lg,pout_macro);
- if (knb_macro)
- printf(F_K_MACRO,f_pos+i_knb_macro*rc_w_lg,knb_macro);
- if (view_macro)
- printf(F_V_MACRO,f_pos+i_view_macro*rc_w_lg,view_macro);
- if (buff_macro)
- printf(F_BCHG,f_pos+i_buff_macro*rc_w_lg,buff_macro);
- if (squit_macro)
- printf(F_SQM,f_pos+i_quit_macro*rc_w_lg,squit_macro);
- if (susr1_macro)
- printf(F_U1M,f_pos+i_usr1_macro*rc_w_lg,susr1_macro);
- if (susr2_macro)
- printf(F_U2M,f_pos+i_usr2_macro*rc_w_lg,susr2_macro);
- if (salarm_macro)
- printf(F_ALARM,f_pos+i_alarm_macro*rc_w_lg,salarm_macro);
- /*}}} */
- }
- /*{{{ keyname*/
- { int i=BIND_NAME_LEN;
- char name[BIND_NAME_LEN+1];
- char *n=name;
-
- while (i--) *n++=vrc_get_c(rc);
- *(n-1)='\0';
- if (misc_out)
- printf(F_NAME,f_pos+RCC_SIZE*rc_w_lg,name);
- }
- /*}}} */
- /*{{{ ocl-opts*/
- { char opts[NO_OCL_CMD_OPTS*(2*BIND_NAME_LEN+2)];
- char *o;
- int o_no;
- off_t o_o_pos;
-
- o_o_pos=f_pos+RCC_SIZE*rc_w_lg+BIND_NAME_LEN*rc_c_lg;
- /*{{{ read options field*/
- for (i=0;i<NO_OCL_CMD_OPTS*(2*BIND_NAME_LEN+2);i++)
- opts[i]=vrc_get_c(rc);
- /*}}} */
- if (misc_out)
- {
- /*{{{ decode options*/
- for (o=opts,o_no=0;*o;)
- { do o++; while (*o);
- *o++='\t';
- while (*o) o++;
- *o++='\n';
- o_no++;
- }
- /*}}} */
- if (o_no)
- printf(F_OCL_OPTS,fo,o_o_pos,o_no,opts,fc);
- }
- }
- /*}}} */
- if (misc_out)
- printf("%s\n",fc);
- break;
- }
- /*}}} */
- /*{{{ termalias*/
- case RC_TERMALIAS:
- { char tname[NAME_LG+1];
- int ch;
- char *s;
-
- if (ktb_out)
- printf(F_T_ALIAS,f_pos);
- while ((ch=vrc_get_c(rc)) && ch!=EOF)
- { s=tname;
- do *s++=(ch=vrc_get_c(rc)); while (ch && ch!=EOF);
- *s='\0';
- if (ktb_out)
- printf(F_T1_ALIAS,tname);
- }
- s=tname;
- do *s++=(ch=vrc_get_c(rc)); while (ch && ch!=EOF);
- if (ktb_out)
- printf(F_T2_ALIAS,tname);
- break;
- }
- /*}}} */
- /*{{{ macroset*/
- case RC_MAC_SET:
- { int lg;
-
- lg=vrc_get_w(rc);
- if (macro_out)
- printf(F_MAC_SET,fo,f_pos,lg);
- do
- { int ml;
- int no;
-
- f_pos=vrc_ftell(rc);
- no=vrc_get_w(rc);
- macsize+=(ml=vrc_get_w(rc))+1;
- if (macro_out)
- printf(F_MACRO_HEAD,fo,f_pos,no,ml+1,"def");
- if (!decode_mac(rc,ml))
- { if (macro_out)
- printf("%s\n",fc);
- lg-=ml+1;
- }
- else
- lg= -1;
- }
- while (lg>0);
- if (macro_out)
- if (!lg)
- printf("%s\n",fc);
- break;
- }
- /*}}} */
- /*{{{ macroload/init*/
- case RC_LOADMACRO:
- case RC_INITMACRO:
- { int macro=vrc_get_w(rc);
- int lg=vrc_get_w(rc);
-
- macsize+=lg+1;
- if (input==RC_LOADMACRO)
- mloadsize+=lg+1;
- if (macro_out)
- printf
- ( F_MACRO_HEAD,
- fo,
- f_pos,
- macro,
- lg+1,
- (input==RC_INITMACRO ? "init" : "load" )
- );
- if (!decode_mac(rc,lg))
- if (macro_out)
- printf("%s\n",fc);
- break;
- }
- /*}}} */
- /*{{{ sets*/
- case RC_CHARSET: {
- int no,word,off,po;
- char class[256];
-
- no=vrc_get_w(rc);
- if (misc_out)
- printf(F_SET_HEAD,fo,f_pos,no);
- while (no)
- /*{{{ decode one class*/
- { for (word=0;word<SET_LG;word++)
- /*{{{ decode a byte*/
- { int byte=vrc_get_c(rc);
-
- for (off=0;off<BITS_P_SET_PAKET;off++)
- { po=word*8+off;
- class[po]=(!(byte&(1<<off))?' ':((po>' ')?po:'X'));
- }
- }
- /*}}} */
- no--;
- if (misc_out)
- { printf(F_SET_NO,no);
- printf(M_NEWLINE);
- /*{{{ print the title-index*/
- printf(" "HEX_CHARS HEX_CHARS HEX_CHARS HEX_CHARS " |");
- printf(M_NEWLINE);
- /*}}} */
- for (word=0;word<16;word+=4)
- /*{{{ print line-index and following line-data*/
- { printf("%c-%c ",word+(word<10?'0':'A'-10),
- word+(word<7 ?'3':'D'-10));
- for (off=0;off<64;off++)
- printf("%c",class[off+word*16]);
- printf(" |");
- printf(M_NEWLINE);
- }
- /*}}} */
- printf(M_NEWLINE);
- }
- }
- /*}}} */
- /*{{{ print set names*/
- if (misc_out)
- printf(F_SET_NAMES,vrc_ftell(rc));
- for (no=vrc_get_w(rc);no;no--)
- { char c;
-
- c=vrc_get_c(rc);
- if (misc_out)
- putchar(c?c:'\n');
- }
- if (misc_out)
- putchar('\n');
- /*}}} */
- if (misc_out)
- printf(F_CLOSE,fc);
- break;
- }
- /*}}} */
- /*{{{ usermodestrings*/
- case RC_MODE: {
- int no;
- int lg;
- char *c;
- char buff1[BIND_NAME_LEN+1];
- char buff2[BIND_NAME_LEN+1];
-
-
- no=vrc_get_c(rc);
- /*{{{ get long*/
- lg=vrc_get_w(rc);
- c=buff1;
- while (lg--) *c++=vrc_get_c(rc);
- *c='\0';
- /*}}} */
- /*{{{ get short*/
- lg=vrc_get_w(rc);
- c=buff2;
- while (lg--) *c++=vrc_get_c(rc);
- *c='\0';
- /*}}} */
- if (misc_out)
- printf(F_U_MODE,f_pos,no,buff1,buff2[0]?buff2:buff1);
- break;
- }
- /*}}} */
- /*{{{ os-extension*/
- case RC_COMMENT:
- case RC_OS_EXTENSION:
- if (misc_out)
- printf(input==RC_COMMENT?F_COMMENT:F_OS_EXT,f_pos);
- while ((input=vrc_get_c(rc)) && input!=EOF)
- if (misc_out)
- printf("%c",input);
- if (misc_out)
- printf(">\n");
- break;
- /*}}} */
- /*{{{ marks*/
- case RC_MARKS: {
- char name[FOLD_PATTERN_LEN];
- int i;
-
- /*{{{ read stored name*/
- for (i=0;i<(FOLD_PATTERN_LEN-1);i++)
- name[i]=vrc_get_c(rc);
- name[FOLD_PATTERN_LEN-1]='\0';
- /*}}} */
- if (misc_out)
- printf(F_MARK,f_pos,name);
- /*{{{ mark*/
- if (misc_out)
- putchar('\'');
- for (i=0;i<FOLD_TAG_LENGTH;i++)
- { char c;
-
- c=vrc_get_c(rc);
- if (misc_out)
- c=putchar(c);
- }
- if (misc_out)
- putchar('\'');
- if (misc_out)
- putchar(' ');
- /*}}} */
- /*{{{ mark*/
- if (misc_out)
- putchar('\'');
- for (i=0;i<FOLD_TAG_LENGTH;i++)
- { char c;
-
- c=vrc_get_c(rc);
- if (misc_out)
- c=putchar(c);
- }
- if (misc_out)
- putchar('\'');
- if (misc_out)
- putchar(' ');
- /*}}} */
- /*{{{ mark*/
- if (misc_out)
- putchar('\'');
- for (i=0;i<FOLD_TAG_LENGTH;i++)
- { char c;
-
- c=vrc_get_c(rc);
- if (misc_out)
- c=putchar(c);
- }
- if (misc_out)
- putchar('\'');
- if (misc_out)
- putchar(' ');
- /*}}} */
- /*{{{ mark*/
- if (misc_out)
- putchar('\'');
- for (i=0;i<FOLD_TAG_LENGTH;i++)
- { char c;
-
- c=vrc_get_c(rc);
- if (misc_out)
- c=putchar(c);
- }
- if (misc_out)
- putchar('\'');
- /*}}} */
- if (misc_out)
- printf(M_NEWLINE);
- break;
- }
- /*}}} */
- /*{{{ mouse-mapping*/
- case RC_M_TAB: {
- int i,j,map;
-
- if (ktb_out)
- printf(F_MO_MAP1,fo,f_pos);
- for (j=0,i=vrc_get_w(rc);i--;j++) {
- map=vrc_get_w(rc);
- if (ktb_out)
- /*{{{ print it*/
- if (map==127)
- printf(F_MO_DEL,j);
- else if (map>=O_NOP)
- printf(F_MO_OP,j,map,get_dec(map));
- else if (map>=' ')
- printf(F_MO_CHAR,j,map,map);
- else
- printf(F_MO_CTRL,j,map,ctrl_c[map]);
- /*}}} */
- }
- if (ktb_out)
- printf(F_CLOSE,fc);
- break;
- }
- /*}}} */
- /*{{{ strings*/
- case RC_STRINGS:
- { int no;
- int ad;
-
- ad=vrc_get_w(rc);
- no=vrc_get_w(rc);
- if (misc_out)
- printf(F_STR,fo,f_pos,ad,no);
- ad+=MSG_ARG_FORMAT;
- while (no--)
- { char c;
-
- c=vrc_get_c(rc);
- if (misc_out)
- if (c)
- putchar(c);
- else
- printf("=%d\n",ad--);
- }
- if (misc_out)
- printf(F_CLOSE,fc);
- break;
- }
- /*}}} */
- /*{{{ compress word list for ref*/
- case RC_REF_COMP_STR:
- { char *code;
-
- code=ref_read_comp_data(rc);
- if (misc_out)
- printf(F_COMP_DATA,fo,f_pos);
- if (code)
- while (*code)
- { do
- if (misc_out)
- putchar(*code);
- while (*++code);
- if (misc_out)
- putchar('\n');
- code++;
- }
- if (misc_out)
- printf(F_CLOSE,fc);
- break;
- }
- /*}}} */
- /*{{{ error!*/
- default:
- printf(F_ERROR,f_pos,input);
- fprintf(stderr,M_BAD_DATA);
- exit (1);
- /*}}} */
- }
- }
- /*}}} */
- f_pos=vrc_ftell(rc);
- }
- /*}}} */
- if (input==RC_BIND)
- /*{{{ show the help*/
- { char line[RC_HELP_LEN+1];
-
- if (ref_out)
- printf(F_HELPHEAD,fo,f_pos);
- while (f_pos=vrc_ftell(rc),vrc_gets(line,RC_HELP_LEN,rc))
- if (ref_out)
- {
- /*{{{ cut newline*/
- { char *t;
-
- for (t=line;*t && *t!='\n';t++);
- *t='\0';
- }
- /*}}} */
- /*{{{ print line*/
- { char *t;
-
- for (t=line;;)
- { switch (*t++)
- { case REF_NODE_LIMITER:
- /*{{{ print decoded line*/
- { char long_line[RC_HELP_LEN+1];
-
- *(t-1)='\0';
- printf
- ( F_H_LINE1,
- f_pos,
- ref_decode_tag((unsigned char*)line),
- t
- );
- fflush(stdout);
- ref_uncompress_text(t,long_line);
- printf
- ( F_H_LINE2,
- strlen(long_line)-strlen(t),
- long_line
- );
- break;
- }
- /*}}} */
- case REF_NODE_ALIAS:
- /*{{{ print decoded alias*/
- { *(t-1)='\0';
- printf
- ( F_H_ALIAS,
- f_pos,
- ref_decode_tag((unsigned char*)line),
- ref_decode_tag((unsigned char*)t)
- );
- break;
- }
- /*}}} */
- case '\0':
- break;
- default:
- continue;
- }
- break;
- }
- }
- /*}}} */
- }
- if (ref_out)
- printf(F_CLOSE,fc);
- }
- /*}}} */
- printf(F_ENDE,f_pos);
- if (macro_out)
- printf(F_MACSIZE,macsize,macsize-mloadsize,mloadsize);
- }
- /*}}} */
- fclose(rc);
- if (mult)
- printf(F_CLOSE,fc);
- }
- /*}}} */
- while (optind!=argc);
- exit(0);
- }
- /*}}} */
-