/*{{{  #includes*/
#include <string.h>
#include <stdlib.h>
#include <stdio.h>

#include <local/bool.h>

#define TEXTC

#include "../h/os.h"
#include "../h/keys.h"
#include "../h/rcformat.h"
#include "../h/envvar_str.h"
#include "viewrc.h"
/*}}}  */

/*{{{  textstrings*/
char F_AUTO_END[]=    "%05d: %s\n";
char F_A_MACRO[]=     "keybind uses macro %d as read-newfile-macro.\n";
char F_K_MACRO[]=     "keybind uses macro %d as key-not-bound-macro.\n";
char F_V_MACRO[]=     "keybind uses macro %d as view-macro.\n";
char F_AB_MACRO[]=    "keybind uses macro %d as abort-macro.\n";
char F_BREAK[]=       "keybind uses %d=%s%c as general-abort-key.\n";
char F_CHAR[]=        "%c";
char F_CLOSE[]=       "%s\n";
char F_COUNTER[]=     "<counter %d>";
char F_DIGIT[]=       "<%d>";
char F_END_MACRO[]=   ">\n       %s\n";
char F_ERROR[]=       "\n%s\n%s%d\n%s\n";
char F_EXIT_START[]=  "%05d: %s\n         <";
char F_HELPHEAD[]=    "%s  helpfile\n";
char F_INTS[]=        "keybind needs %d variables.\n";
char F_MACS[]=        "keybind needs %d fix-macros.\n";
char F_KEY_HEAD[]=    "%s  keyboard %3d (terminal %s,bindmarks %4d,%4d), using %4d nodes\n";
char F_MACRO_HEAD[]=  "%s  macro %3d (lg=%4d) %s\n";
char F_MARK[]=        "keybind has additional mark-typ %s : ";
char F_MSG[]=         "<message %d>";
char F_MO_CHAR[]=     "mousebutton %3d invokes %4d=( %c )\n";
char F_MO_CTRL[]=     "mousebutton %3d invokes %4d=( C-%c )\n";
char F_MO_DEL[]=      "mousebutton %3d invokes %4d=( DEL )\n";
char F_MO_MAP1[]=     "%s  mouse-bindings\n";
char F_MO_OP[]=       "mousebutton %3d invokes %4d=( %s )\n";
char F_M_V1[]=        "%s  mouse-variables\n";
char F_M_V2[]=        "mouse-varibles:\n      x=%d\n      y=%d\n   yoff=%d\noutside=%d\n button=%d\n";
char F_MACSIZE[]=     "binding uses %d tokens\n";
char F_NAME[]=        "name of this keybind is %s.\n";
char F_NODE_VALUE[]=  "%4d: key %3d=%s | ne %4d | nl %4d";
char F_NORM[]=        "%05d: -><%d>";
char F_NORM_PC[]=     "%05d: ->%c";
char F_NO_RC[]=       "no rc-file %s.\n";
char F_OP[]=          "%05d: %s\n";
char F_OP_1_INT[]=    "%05d: %-20s %6d\n";
char F_OP_2_INT[]=    "%05d: %-20s %6d %3d\n";
char F_OP_IIP[]=      "%05d: %-20s %6d %3d\n         <";
char F_OP_ADRESS[]=   "%05d: %-20s  %05d (%6d)\n";
char F_OP_CHAR[]=     "%05d: %s '%c'\n";
char F_OP_CODE[]=     "%05d: %s 'C-%c'\n";
char F_PI_MACRO[]=    "keybind uses macro %d as begin-prompt-macro.\n";
char F_PO_MACRO[]=    "keybind uses macro %d as end-prompt-macro.\n";
char F_PROMPT_START[]="%05d: %-20s %6d\n         <";
char F_U_MODE[]=      "usermode %d, long: %s, short: %s.\n";
char F_S1_VAR[]=      "%s  standard-variables\n";
char F_S2_VAR[]=      "read-tab-width-variable %d\nscreen-x %d\nscreen-y %d\ncursor-level %d\nocl-arg %d\n";
char F_SET_HEAD[]=    "%s  using %6d character classes\n";
char F_SET_NO[]=      "character class %6d:";
char F_T1_ALIAS[]=    " %s";
char F_T2_ALIAS[]=    " ) replaced by %s.\n";
char M_CODE_NODE[]=   " => co %4d = ( %c )\n";
char M_COM_NODE[]=    " => co %4d = ( %s )\n";
char M_CTRL_NODE[]=   " => co %4d = ( C-%c )\n";
char M_DEL_NODE[]=    " => co %4d = ( DEL )\n";
char M_END_ST[]=      "<-\n";
char M_NODIS[]=       "no dissassemble possible.";
char M_BAD_DATA[]=    "incorrect data in rc!\n";
char M_LINE[]=        "-----------------------------------------";
char M_NEWLINE[]=     "\n";
char M_T_ALIAS[]=     "terminals (";
char M_TOK[]=         "'token'";
char M_UNKNOWN[]=     "unknown";
char M_USAGE[]=       "viewrc [-his?] [-k namebase]\nversion: " VERSION "\n";
char M_STAT[]=        "no statusline\n";
char M_OS_EXT[]=      "os-specific text";
/*}}}  */
/*{{{  show_help*/
void show_help(void)
{ printf("%s  description of fileformat (version: " VERSION " ) \n\n",fo);
  /*{{{  contents of info-fold*/
  printf("used outputformats are:\n\n");
  /*{{{  number of macs*/
  printf("  keybind needs <number> fix-macros.\n");
  printf("    Origami has initialised <number> macros.\n\n");
  /*}}}  */
  /*{{{  standard vars*/
  printf("  %s  standard-variables\n",fo);
  printf("  read-tab-width-variable <number>\n    :\n");
  printf("  %s\n",fc);
  printf("    the numbers specify the position in the OCL-variable-list.\n\n");
  /*}}}  */
  /*{{{  mouse vars*/
  printf("  %s  mouse-variables\n",fo);
  printf("  x=<number>\n    :\n");
  printf("  %s\n",fc);
  printf("    the numbers specify the position in the OCL-variable-list.\n\n");
  /*}}}  */
  /*{{{  no statusline*/
  printf("  no statusline\n");
  printf("    Origami doesn't display the statusline\n\n");
  /*}}}  */
  /*{{{  name*/
  printf("  name of this keybind is <name>\n");
  printf("    <name> replaces origami in the commandline\n\n");
  /*}}}  */
  /*{{{  mark*/
  printf("  keybind has additional mark-typ <name> : @ <c1> <c2> <c3> $ ..\n");
  printf("    <name> can be used with ``-m<name>''  to  use  <marks>  ..  for  the\n");
  printf("    folds.\n\n");
  /*}}}  */
  /*{{{  usermode*/
  printf("  usermode <modenummer>, long: <longstring>, short: <shortname>.\n");
  printf("    Internal mode <number> uses <longstring> and  <shortstring>  in  the\n");
  printf("    statusline.\n\n");
  /*}}}  */
  /*{{{  os-extension*/
  printf("  os-specific text (<text>)\n");
  printf("    This will be ignored by standard Origamis. Only some speciell ports\n");
  printf("    this text.  See the port-manuals for more information.\n\n");
  /*}}}  */
  /*{{{  macro*/
  printf("  %s  macro  <number> (lg=  <used tokens>) <defmode>)\n",fo);
  printf("  this is only an example!\n");
  printf("  %s\n",fc);
  printf("    The fold contains the disassembled code  for  fixed-macro  <number>.\n");
  printf("    The macro uses <used tokens>.  If  <defmode> is ``def'', you are not\n");
  printf("    allowed to redefine it with ``O_DEFINE_FIX''.\n\n");
  /*}}}  */
  /*{{{  automacro*/
  printf("  keybind uses macro <number> as read-newfile-macro.\n\n");
  /*}}}  */
  /*{{{  abortmacro*/
  printf("  keybind uses macro <number> as abort-macro.\n\n");
  /*}}}  */
  /*{{{  not-bound*/
  printf("  keybind uses macro <number> as key-not-bound-macro.\n\n");
  /*}}}  */
  /*{{{  view-mac*/
  printf("  keybind uses macro <number> as view-macro.\n\n");
  /*}}}  */
  /*{{{  promptin*/
  printf("  keybind uses macro <number> as begin-prompt-macro.\n\n");
  /*}}}  */
  /*{{{  promptout*/
  printf("  keybind uses macro <number> as end-prompt-macro.\n\n");
  /*}}}  */
  /*{{{  abort*/
  printf("  keybind uses <decimal key>=<ascii-code> as general-abort-key.\n\n");
  /*}}}  */
  /*{{{  vars*/
  printf("  keybind needs <number> variables.\n\n");
  /*}}}  */
  /*{{{  character-sets*/
  printf("  %s  using <number> character classes\n",fo);
  printf("  this is only an example!\n");
  printf("  %s\n",fc);
  printf("    This fold contains all userdefined character classes,  which can  be\n");
  printf("    used  in  tests.  Each  class  is  listed  in  a  block.  Characters\n");
  printf("    lower-equal   \"  \"  are marked with \"X\". All  Other  characters  are\n");
  printf("    marked by themself.\n\n");
  /*}}}  */
  /*{{{  mouse bindings*/
  printf("  %s  mouse-bindings\n",fo);
  printf("  mousebutton <number> invokes <command>\n     :\n");
  printf("  %s\n",fc);
  printf("    display bindings of the mouse-buttons to commands.\n\n");
  /*}}}  */
  /*{{{  termalias*/
  printf("  terminals (<termname> .. ) replaced by <termname>.\n");
  printf("    $TERM/$ORITERM set to one of the first  names will use the  keytable\n");
  printf("    defined for the last given name.\n\n");
  /*}}}  */
  /*{{{  keyboard*/
  printf("  %s  keyboard  <number>(terminal <name>, bindmarks <number> <number>), using <number> nodes\n",fo);
  printf("  this is only an example!\n");
  printf("  %s\n",fc);
  printf("    The terminal name is used to  decide, whether  this table should be\n");
  printf("    active. The bindmarks are the codes, specifying,  which part of the\n");
  printf("    binding-list is valid. The  fold  contains the complete information\n");
  printf("    to decode keyboardinputs. It shows the internal datatree of origami\n");
  printf("    in the following way:\n");
  printf("      Each line shows the contents of treenode:\n");
  printf("        <no>: key <decimal>=<ascii> | ne <next> | nl <level>\n");
  printf("      with\n");
  printf("        <no>    number of the node\n");
  printf("        <decimal> and <ascii>\n");
  printf("                are the pressed key\n");
  printf("        <next>  number of the next node for the current inputposition\n");
  printf("                (there are other keysequences with the same beginning)\n");
  printf("        <level> number of next node for the next inputposition\n");
  printf("      optional is the trailing output:\n");
  printf("        => co <number> = ( <tokenname> )\n");
  printf("      its used, if the current input matches an origamicommand  <number>\n");
  printf("      or <tokenname>.\n");
  printf("    The node 0 is the toplevel node of the tree. Nodenumber  -1  is  the\n");
  printf("    nil-pointer.\n\n");
  /*}}}  */
  /*{{{  macsize*/
  printf("binding uses <number> tokens\n");
  printf("  number of used tokens in all macros.\n");
  /*}}}  */
  /*{{{  help*/
  printf("  %s  helpfile\n",fo);
  printf("  this is only an example!\n");
  printf("  %s\n",fc);
  printf("    This fold contains the  complete  online-bindinghelp  for  all  used\n");
  printf("    keyboardmodes, the mouse and maybe the referenz-card.\n\n");
  /*}}}  */
  /*}}}  */
  printf("%s\n",fc);
}
/*}}}  */
