home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Texteditors / Origami / Sources / src / viewrc / text.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-27  |  16.1 KB  |  343 lines

  1. /*{{{}}}*/
  2. /*{{{  #includes*/
  3. #include <string.h>
  4. #include <stdlib.h>
  5. #include <stdio.h>
  6.  
  7. #define TEXTC
  8.  
  9. #include <h/keys.h>
  10. #include <h/envvar_str.h>
  11. /*}}}  */
  12.  
  13. /*{{{  fold-marks*/
  14. char fo[FOLD_TAG_LENGTH+1]=BEGIN_STANDARD;
  15. char fc[FOLD_TAG_LENGTH+1]=END_STANDARD;
  16. /*}}}  */
  17. /*{{{  names and messages*/
  18. #include "name.h"
  19. #include "keybind/msgname.c"
  20. /*}}}  */
  21. /*{{{  textstrings*/
  22. /*{{{  define formats for rc-offsets*/
  23. #define X_ADR   "%07lx"
  24. #define X_HELP  "ooooooo"
  25. #define DUMMY_FOLD "---  "
  26. #define F_POS   X_ADR " "
  27. #define F_OH    X_HELP " "
  28. /*}}}  */
  29. /*{{{  define strings for command,adress,..*/
  30. #define CHAR          "%c"
  31. #define CTRL_CHAR     "C-" CHAR
  32. #define OCL_INT       "%6d"
  33. #define SM_INT        "%4d"
  34.  
  35. #define KEY_VAL       "%3d"
  36. #define KEY_CODE      "%3s"
  37. #define KEY_CHAR      " " CHAR " "
  38.  
  39. #define COMMAND       "%-24s"
  40. #define INT_ARG       OCL_INT
  41. #define CHAR_ARG      OCL_INT " =     " CHAR
  42. #define CTRL_CHAR_ARG OCL_INT " =   " CTRL_CHAR
  43. #define ADRESS        "%05d "
  44. #define ADR_ARG       OCL_INT " = " ADRESS
  45. #define WHITE_ADR     "      "
  46.  
  47. #define MACRO_NUM     "%4d"
  48.  
  49. #define CMD_ARROW     " => "
  50. /*}}}  */
  51. char const F_AB_MACRO[]=    DUMMY_FOLD F_POS "keybind uses macro " MACRO_NUM " as abort-macro.\n";
  52. char const F_AUTO_END[]=    ADRESS " " COMMAND "\n";
  53. char const F_A_MACRO[]=     DUMMY_FOLD F_POS "keybind uses macro " MACRO_NUM " as read-newfile-macro.\n";
  54. char const F_BCHG[]=        DUMMY_FOLD F_POS "keybind uses macro " MACRO_NUM " as change-buffer-macro.\n";
  55. char const F_CRASH[]=       "CRASH, maybe rc-file is corrupted at " F_POS "!\n";
  56. char const F_SQM[]=         DUMMY_FOLD F_POS "keybind uses macro " MACRO_NUM " as sigquit-macro.\n";
  57. char const F_U1M[]=         DUMMY_FOLD F_POS "keybind uses macro " MACRO_NUM " as sigusr1-macro.\n";
  58. char const F_U2M[]=         DUMMY_FOLD F_POS "keybind uses macro " MACRO_NUM " as sigusr2-macro.\n";
  59. char const F_ALARM[]=       DUMMY_FOLD F_POS "keybind uses macro " MACRO_NUM " as sigalarm-macro.\n";
  60. char const F_BREAK[]=       DUMMY_FOLD F_POS "keybind uses " KEY_VAL "=" KEY_CODE KEY_CHAR" as general-abort-key.\n";
  61. char const F_CHAR[]=        CHAR;
  62. char const F_CHECK[]=       DUMMY_FOLD F_POS "format-code " OCL_INT ", " MAJOR_VERSION "." MINOR_VERSION "." REVISION " uses " OCL_INT ".\n";
  63. char const F_CLOSE[]=       "%s\n";
  64. char const F_COMMENT[]=     "ccc  " X_ADR " <";
  65. char const F_COMP_DATA[]=   "%s  " F_POS "reference compression strings\n";
  66. char const F_CONST[]=       "%s  " F_POS "constants\n";
  67. char const F_COUNTER[]=     "<counter " INT_ARG ">";
  68. char const F_DIGIT[]=       "<" KEY_VAL ">";
  69. char const F_ENDE[]=        DUMMY_FOLD F_POS "end of rc-file\n";
  70. char const F_END_MACRO[]=   ">\n" WHITE_ADR " " COMMAND "\n";
  71. char const F_ERROR[]=       DUMMY_FOLD F_POS "\n"
  72.                             "-----------------------------------------\n"
  73.                             "'token' " OCL_INT "unknown\n"
  74.                             "no dissassemble possible\n";
  75. char const F_EXIT_START[]=  ADRESS " " COMMAND "\n         <";
  76. char const F_F_LIST[]=      DUMMY_FOLD F_POS "start with list of edited files\n";
  77. char const F_HELPHEAD[]=    "%s  " F_POS "helpfile\n";
  78. char const F_HIST[]=        "<history " INT_ARG ">";
  79. char const F_H_ALIAS[]=     X_ADR "\ttag=%5d, next=%5d\n";
  80. char const F_H_LINE1[]=     X_ADR "\ttag=%5d, code ='%s'";
  81. char const F_H_LINE2[]=     "+%3d=\n '%s'\n";
  82. char const F_INTS[]=        DUMMY_FOLD F_POS "keybind needs " OCL_INT " variables.\n";
  83. char const F_KEY_HEAD[]=    "%s  " F_POS "keyboard\t%s\tmarks%s nodes " OCL_INT "\n";
  84. char const F_KNB_NODE[]=    CMD_ARROW"trigger key-not-bound\n";
  85. char const F_K_MACRO[]=     DUMMY_FOLD F_POS "keybind uses macro " MACRO_NUM " as key-not-bound-macro.\n";
  86. char const F_KTBS[]=        DUMMY_FOLD F_POS "keybind needs " SM_INT " keytables.\n";
  87. char const F_LINE_LIM[]=    DUMMY_FOLD F_POS "line limiter is '" CHAR "'\n";
  88. char const F_MACRO_HEAD[]=  "%s  " F_POS "macro " MACRO_NUM " (lg=" OCL_INT ") %s\n";
  89. char const F_MACSIZE[]=     "binding uses " OCL_INT " tokens (" OCL_INT " fixed," OCL_INT " demand loading)\n";
  90. char const F_MACS[]=        DUMMY_FOLD F_POS "keybind needs " OCL_INT " fix-macros.\n";
  91. char const F_MAC_SET[]=     "%s  " F_POS "macro set " OCL_INT " tokens\n";
  92. char const F_MARK[]=        DUMMY_FOLD F_POS "keybind has additional mark-typ %s : ";
  93. char const F_MODE_LIM[]=    DUMMY_FOLD F_POS "mode limiter is '" CHAR "'\n";
  94. char const F_MO_MAP1[]=     "%s  " F_POS "mouse-bindings\n";
  95. char const F_MO_CHAR[]=     "mousebutton " SM_INT " invokes " MACRO_NUM "=" CHAR "\n";
  96. char const F_MO_CTRL[]=     "mousebutton " SM_INT " invokes " MACRO_NUM "=" CTRL_CHAR "\n";
  97. char const F_MO_DEL[]=      "mousebutton " SM_INT " invokes " MACRO_NUM "=DEL\n";
  98. char const F_MO_OP[]=       "mousebutton " SM_INT " invokes " MACRO_NUM "=" COMMAND "\n";
  99. char const F_MSG[]=         "<message " SM_INT "=%s>";
  100. char const F_M_V1[]=        "%s  " F_POS "mouse-variables\n";
  101. char const F_M_V2[]=        "mouse-variables:\n"
  102.                             OCL_INT " <-> "MOUSE_X "\n"
  103.                             OCL_INT " <-> "MOUSE_Y "\n"
  104.                             OCL_INT " <-> "MOUSE_G "\n"
  105.                             OCL_INT " <-> "MOUSE_O "\n"
  106.                             OCL_INT " <-> "MOUSE_B "\n"
  107.                             OCL_INT " <-> "MOUSE_W "\n";
  108. char const F_NAME[]=        DUMMY_FOLD F_POS "name of this keybind is %s.\n";
  109. char const F_NODE_VALUE[]=  SM_INT ": key " KEY_VAL "=" KEY_CODE " | ne " SM_INT " | nl " SM_INT;
  110. char const F_NO_RC[]=       "no rc-file %s.\n";
  111. char const F_NORM[]=        ADRESS " -><" OCL_INT ">";
  112. char const F_NORM_PC[]=     ADRESS " ->" CHAR;
  113. char const F_OCL_OPTS[]=    "%s  " F_POS OCL_INT " ocl-options\n%s%s\n";
  114. char const F_OP[]=          ADRESS " " COMMAND "\n";
  115. char const F_OP_1_INT[]=    ADRESS " " COMMAND " " INT_ARG "\n";
  116. char const F_OP_2_INT[]=    ADRESS " " COMMAND " " INT_ARG "  " INT_ARG "\n";
  117. char const F_OP_ADRESS[]=   ADRESS " " COMMAND " " ADR_ARG "\n";
  118. char const F_OP_CHAR[]=     ADRESS " " COMMAND " " CHAR_ARG "\n";
  119. char const F_OP_CODE[]=     ADRESS " " COMMAND " " CTRL_CHAR_ARG "\n";
  120. char const F_OP_IIP[]=      ADRESS " " COMMAND " " INT_ARG " " INT_ARG "\n         <";
  121. char const F_PROMPT_START[]=ADRESS " " COMMAND " " INT_ARG "\n         <";
  122. char const F_OS_EXT[]=      DUMMY_FOLD F_POS "os-specific text <";
  123. char const F_PI_MACRO[]=    DUMMY_FOLD F_POS "keybind uses macro " MACRO_NUM " as begin-prompt-macro.\n";
  124. char const F_PO_MACRO[]=    DUMMY_FOLD F_POS "keybind uses macro " MACRO_NUM " as end-prompt-macro.\n";
  125. char const F_S1_VAR[]=      "%s  " F_POS "standard-variables\n";
  126. char const F_S2_VAR[]=      OCL_INT " <-> "SCR_W "\n"
  127.                             OCL_INT " <-> "SCR_W_O "\n"
  128.                             OCL_INT " <-> "SCR_H "\n"
  129.                             OCL_INT " <-> "SCR_H_O "\n"
  130.                             OCL_INT " <-> "CURSOR_LEVEL "\n"
  131.                             OCL_INT " <-> "OCL_ARG_V "\n"
  132.                             OCL_INT " <-> "F_N_VAR "\n"
  133.                             OCL_INT " <-> "U_B_VAR "\n"
  134.                             OCL_INT " <-> "C_B_VAR "\n"
  135.                             OCL_INT " <-> "C_BI_VAR "\n"
  136.                             OCL_INT " <-> "M_B_VAR "\n"
  137.                             OCL_INT " <-> "M_O_VAR "\n"
  138.                             OCL_INT " <-> "K_C_VAR "\n"
  139.                             OCL_INT " <-> "VAR_PATH_SEP "\n"
  140.                             OCL_INT " <-> "DIRED_VAR "\n";
  141. char const F_SET_HEAD[]=    "%s  " F_POS "using " SM_INT " character classes\n";
  142. char const F_SET_NO[]=      "character class " SM_INT ":";
  143. char const F_SHIFT_MARK[]=  DUMMY_FOLD F_POS "shift mark is '" CHAR "'\n";
  144. char const F_STAT[]=        DUMMY_FOLD F_POS "no statusline\n";
  145. char const F_STR[]=         "%s  " F_POS OCL_INT " strings ("OCL_INT " chars)\n";
  146. char const F_T1_ALIAS[]=    " %s";
  147. char const F_T2_ALIAS[]=    " ) replaced by %s.\n";
  148. char const F_T_ALIAS[]=     DUMMY_FOLD F_POS "terminals (";
  149. char const F_U_MODE[]=      DUMMY_FOLD F_POS "usermode " SM_INT ", long: %s, short: %s.\n";
  150. char const F_V_MACRO[]=     DUMMY_FOLD F_POS "keybind uses macro " MACRO_NUM " as view-macro.\n";
  151. char const M_BAD_DATA[]=    "incorrect data in rc!\n";
  152. char const M_CODE_NODE[]=   CMD_ARROW"co " MACRO_NUM "=" CHAR "\n";
  153. char const M_COM_NODE[]=    CMD_ARROW"co " MACRO_NUM "=" COMMAND "\n";
  154. char const M_CTRL_NODE[]=   CMD_ARROW"co " MACRO_NUM "=" CTRL_CHAR "\n";
  155. char const M_DEL_NODE[]=    CMD_ARROW"co " MACRO_NUM "=DEL\n";
  156. char const M_END_ST[]=      "<-\n";
  157. char const M_FAR_NEXT[]=    CMD_ARROW"far next\n";
  158. char const M_NEWLINE[]=     "\n";
  159. char const F_SET_NAMES[]=   "classnames (" F_POS "):";
  160. char const M_UNKNOWN[]=     "unknown";
  161. char const M_USAGE[]=       "viewrc [-fhikmr?] [filename ... ]\nversion: " MAJOR_VERSION "." MINOR_VERSION "." REVISION "\n";
  162. /*}}}  */
  163. /*{{{  show_help*/
  164. void show_help(void)
  165. {
  166.   printf("%s  description of fileformat (version: " MAJOR_VERSION "." MINOR_VERSION "." REVISION " )\n"
  167.          "\n",fo);
  168.   /*{{{  contents of info-fold*/
  169.   puts  ("used output formats are(" X_HELP " is the hex offset in the rc file):\n");
  170.   /*{{{  check*/
  171.   puts  ("  " DUMMY_FOLD F_OH "format-code <number>, " MAJOR_VERSION "." MINOR_VERSION "." REVISION " uses <number>.\n"
  172.          "    Show the rc error-check word.\n");
  173.   /*}}}  */
  174.   /*{{{  constants*/
  175.   printf("  %s  " F_OH "constants\n",fo);
  176.   /*{{{  number of macs*/
  177.   puts  ("  " DUMMY_FOLD F_OH "keybind needs <number> fix-macros.\n"
  178.          "    Origami has initialised <number> macros.\n");
  179.   /*}}}  */
  180.   /*{{{  vars*/
  181.   puts  ("  " DUMMY_FOLD F_OH "keybind needs <number> variables.\n");
  182.   /*}}}  */
  183.   /*{{{  standard vars*/
  184.   printf("  %s  " F_OH "standard-variables\n"
  185.          "  <number> <-> <name>\n"
  186.          "    :\n"
  187.          "  %s\n"
  188.          "    the numbers specify the position in the OCL-variable-list.\n"
  189.          "\n",fo,fc);
  190.   /*}}}  */
  191.   /*{{{  mouse vars*/
  192.   printf("  %s  " F_OH "mouse-variables\n"
  193.          "  <number> <-> <name>\n"
  194.          "    :\n"
  195.          "  %s\n"
  196.          "    the numbers specify the position in the OCL-variable-list.\n"
  197.          "\n",fo,fc);
  198.   /*}}}  */
  199.   /*{{{  abort*/
  200.   puts  ("  " DUMMY_FOLD F_OH "keybind uses <decimal key>=<ascii-code> as general-abort-key.\n");
  201.   /*}}}  */
  202.   /*{{{  limiters*/
  203.   puts  ("  " DUMMY_FOLD F_OH "line limiter is '<char>'\n"
  204.          "    The character replaces the '$' as marker for long lines.\n"
  205.          "\n"
  206.          "  " DUMMY_FOLD F_OH "mode limiter is '<char>'\n"
  207.          "    The character replaces the ',' between modes in the statusline.\n");
  208.   /*}}}  */
  209.   /*{{{  no statusline*/
  210.   puts  ("  " DUMMY_FOLD F_OH "no statusline\n"
  211.          "    Origami doesn't display the statusline\n");
  212.   /*}}}  */
  213.   /*{{{  list of edited files*/
  214.   puts  ("  " DUMMY_FOLD F_OH "start with list of edited files\n"
  215.          "    Origami starts editing the list of edited files\n");
  216.   /*}}}  */
  217.   /*{{{  automacro*/
  218.   puts  ("  " DUMMY_FOLD F_OH "keybind uses macro <number> as read-newfile-macro.\n");
  219.   /*}}}  */
  220.   /*{{{  abortmacro*/
  221.   puts  ("  " DUMMY_FOLD F_OH " keybind uses macro <number> as abort-macro.\n");
  222.   /*}}}  */
  223.   /*{{{  promptin*/
  224.   puts  ("  " DUMMY_FOLD F_OH "keybind uses macro <number> as begin-prompt-macro.\n");
  225.   /*}}}  */
  226.   /*{{{  promptout*/
  227.   puts  ("  " DUMMY_FOLD F_OH "keybind uses macro <number> as end-prompt-macro.\n");
  228.   /*}}}  */
  229.   /*{{{  not-bound*/
  230.   puts  ("  " DUMMY_FOLD F_OH "keybind uses macro <number> as key-not-bound-macro.\n");
  231.   /*}}}  */
  232.   /*{{{  view-mac*/
  233.   puts  ("  " DUMMY_FOLD F_OH "keybind uses macro <number> as view-macro.\n");
  234.   /*}}}  */
  235.   /*{{{  chg_b_macro*/
  236.   puts  ("  " DUMMY_FOLD F_OH "keybind uses macro <number> as change-buffer-macro.\n");
  237.   /*}}}  */
  238.   /*{{{  name*/
  239.   puts  ("  " DUMMY_FOLD F_OH "name of this keybind is <name>\n"
  240.          "    <name> replaces origami in the commandline\n");
  241.   /*}}}  */
  242.   printf("  %s\n\n",fc);
  243.   /*}}}  */
  244.   /*{{{  strings*/
  245.   printf("  %s  " F_OH "<number> strings\n"
  246.          "  contains all rc messages for this file\n"
  247.          "  %s\n"
  248.          "\n",fo,fc);
  249.   /*}}}  */
  250.   /*{{{  mark*/
  251.   puts  ("  " DUMMY_FOLD F_OH "keybind has additional mark-typ <name> : '<c1><c2><c3>' ..\n"
  252.          "    <name> can be used with ``-m<name>''  to use <c1><c2><c3> .. for the\n"
  253.          "    folds.\n");
  254.   /*}}}  */
  255.   /*{{{  usermode*/
  256.   puts  ("  " DUMMY_FOLD F_OH "usermode <modenummer>, long: <longstring>, short: <shortname>.\n"
  257.          "    Internal mode <number> uses <longstring> and  <shortstring>  in  the\n"
  258.          "    statusline.\n");
  259.   /*}}}  */
  260.   /*{{{  rc-comment*/
  261.   puts  ("  ccc  " X_HELP ": <<text>>\n"
  262.          "    This will be ignored by Origami.\n");
  263.   /*}}}  */
  264.   /*{{{  os-extension*/
  265.   puts  ("  " DUMMY_FOLD F_OH "os-specific text (<text>)\n"
  266.          "    This will be ignored by standard Origamis. Only some speciell ports\n"
  267.          "    this text.  See the port-manuals for more information.\n");
  268.   /*}}}  */
  269.   /*{{{  macro*/
  270.   printf("  %s  " F_OH "macro  <number> (lg=  <used tokens>) <defmode>)\n"
  271.          "  this is only an example!\n"
  272.          "  %s\n"
  273.          "    The fold contains the disassembled code  for  fixed-macro  <number>.\n"
  274.          "    The macro uses <used tokens>.  If  <defmode> is ``def'', you are not\n"
  275.          "    allowed to redefine it with ``O_DEFINE_FIX''.\n"
  276.          "\n",fo,fc);
  277.   /*}}}  */
  278.   /*{{{  character-sets*/
  279.   printf("  %s  " F_OH "using <number> character classes\n"
  280.          "  this is only an example!\n"
  281.          "  %s\n"
  282.          "    This fold contains all userdefined character classes,  which can  be\n"
  283.          "    used  in  tests.  Each  class  is  listed  in  a  block.  Characters\n"
  284.          "    lower-equal   \"  \"  are marked with \"X\". All  Other  characters  are\n"
  285.          "    marked by themself.\n"
  286.          "\n",fo,fc);
  287.   /*}}}  */
  288.   /*{{{  mouse bindings*/
  289.   printf("  %s  " F_OH "mouse-bindings\n"
  290.          "  mousebutton <number> invokes <command>\n     :\n"
  291.          "  %s\n"
  292.          "    display bindings of the mouse-buttons to commands.\n"
  293.          "\n",fo,fc);
  294.   /*}}}  */
  295.   /*{{{  termalias*/
  296.   puts  ("  " DUMMY_FOLD F_OH "terminals (<termname> .. ) replaced by <termname>.\n"
  297.          "    $"TERM"/$"ORITERM" set to one of the first  names will use the  keytable\n"
  298.          "    defined for the last given name.\n");
  299.   /*}}}  */
  300.   /*{{{  keyboard*/
  301.   printf("  %s  " F_OH "keyboard\t<term-name>\tmarks <number>+ nodes <number>\n"
  302.          "  this is only an example!\n"
  303.          "    The terminal name is used to  decide, whether  this table should be\n"
  304.          "    active. The bindmarks are the codes, specifying,  which part of the\n"
  305.          "    binding-list is valid. The  fold  contains the complete information\n"
  306.          "    to decode keyboardinputs. It shows the internal datatree of origami\n"
  307.          "    in the following way (the first next-chain represents the modes):\n"
  308.          "      Each line shows the contents of treenode:\n"
  309.          "        <no>: key <decimal>=<ascii> | ne <next> | nl <level>\n"
  310.          "      with\n"
  311.          "        <no>    number of the node\n"
  312.          "        <decimal> and <ascii>\n"
  313.          "                are the pressed key\n"
  314.          "        <next>  number of the next node for the current inputposition\n"
  315.          "                (there are other keysequences with the same beginning)\n"
  316.          "        <level> number of next node for the next inputposition\n"
  317.          "      optional is the trailing output:\n"
  318.          "        => co <number> = ( <tokenname> )\n"
  319.          "      its used, if the current input matches an origamicommand  <number>\n"
  320.          "      or <tokenname>.\n"
  321.          "    The node 0 is the toplevel node of the tree. Nodenumber  -1  is  the\n"
  322.          "    nil-pointer.\n"
  323.          "  %s"
  324.          "\n",fo,fc);
  325.   /*}}}  */
  326.   /*{{{  help*/
  327.   printf("  %s  " F_OH "helpfile\n"
  328.          "  this is only an example!\n"
  329.          "  %s\n"
  330.          "    This fold contains the  complete  online-bindinghelp  for  all  used\n"
  331.          "    keyboardmodes,  the mouse and maybe the  referenz-card.  Every  text\n"
  332.          "    line will be shown with offset and tag.\n"
  333.          "\n",fo,fc);
  334.   /*}}}  */
  335.   /*{{{  macsize*/
  336.   puts  ("  binding uses <number> tokens\n"
  337.          "    number of used tokens in all macros.\n");
  338.   /*}}}  */
  339.   /*}}}  */
  340.   printf("%s\n",fc);
  341. }
  342. /*}}}  */
  343.