[comp.sys.handhelds] hpread to ascii

wbarry@hikita.wpi.EDU (William Harrison Barry) (10/17/90)

I have just started using the hpread program with my 28S.  I was
wondering if it is 
possible to convert the downloaded data into a form that appears the
same as it does
on the 28.  Program delimiters, arrows and most anything that is not
between 1 and 
z in ASCII is not the same numeric value on the 28.  Does anyone have a
program that 
solves this problem.  A Turbo-C progam is best for my use.

Any postings to the net that would solve this problem would be very helpfull.

madler@piglet.caltech.edu (Mark Adler) (10/17/90)

>> I have just started using the hpread program with my 28S.  I was
>> wondering if it is possible to convert the downloaded data into a form
>> that appears the same as it does on the 28.

After this message is the program HPTRANS.C and HPTABLE.ASC (a translation
table used by HPTRANS).  It is used as a filter after HPREAD.

Also, I'm curious about your experience with HPREAD, what hardware you're
using it on, etc.  (I wrote the thing.)

Mark Adler
madler@piglet.caltech.edu

--- HPTRANS.C ---
  /*
  HPTRANS   Revision 1.0   James Gentles   27th Feb 1990   jdg@hpqtdla.hp.com
   
  This program accepts from stdinput a file created by the HPREAD program from
  the HP28's IR link. This file is coded in the HP28 version of ASCII which
  has special characters in locations 128-255. This program takes a file of
  replacement characters (HPTABLE.ASC) and replaces the special HP28 characters.
  The output to stdoutput is a file with all the special characters replaced
  with a string of 1 or more characters from the look up table.
  */
   
  #include <stdio.h>
   
  main()
  {
  int c;
  int i;
  int j;
   
  char string[128][10];
  int  keyflag[128];
  char keychar[128][60];
   
  FILE  *fopen(), *tableF;
   
  tableF = fopen("HPTABLE.ASC" , "r");
   
  i=1;
  while (i <= 128)
      {
      fscanf(tableF, "%s", string[i] );
    /* Suck in 128 sets of 2 strings   */
      fscanf(tableF, "%s", keychar[i]);
    /* from HPTABLE.ASC                */
      Skeyflag[i]=0;
      i+=1;
      }
  while ((c = getchar()) != EOF)
       if (c <= 127)                    /* CHR 0 to 127 pass straight through */
            putchar(c);
       else
            {
            printf("%s" , string[(c-127)]);/* ELSE replace with string from   */
            keyflag[(c-127)] = 1;          /* HPTABLE.ASC and set keyflag     */
            }
  printf("\n \nSYMBOL KEY:\n");            /* Print Heading for Table         */
  i=1;                                     /* then print strings that have    */
  while (i <=128)                          /* been used in listing.           */
        {
        if(keyflag[i] ==1) printf("\n%s  %s\n" , string[i], keychar[i] );
        i+=1;
        }
  }
--- HPTABLE.ASC ---
  space$ 128:-Blank
  div$ 129:-Division_line&dots
  mul$ 130:-Multiply_cross
  SQRT 131:-Square_root_symbol
  int$ 132:-Integral
  sig$ 133:-Sigma
  |>$ 134:-Triangular_right_arrow
  pi 135:-Symbolic_constant
  delta$ 136:-Greek_delta
  <= 137:-Less_than_&_equal_to
  >= 138:-Greater_than_&_equal_to
  <> 139:-Not_equal_to
  alpha$ 140:-Greek_alpha
  -> 141:-Right_hand_arrow
  <- 142:-Left_hand_arrow
  micro$ 143:-10E-6
  lf$ 144:-L/F_symbol
  deg$ 145:-Degree_symbol
  << 146:-Start_program_construct
  >> 147:-End_program_construct
  |-$ 148:-T_on_side
  1 149:-Subscript_1
  2 150:-Subscript_2
  2 151:-Superscript_2
  3 152:-Superscript_3
  ; 153:-Subscript/inverse_;
  j 154:-Subscript_j
  .. 155:-Double_dot
  ; 156:-Superscript/inverse_;
  ; 157:-Superscript_j
  k 158:-Superscript_k
  n 159:-Superscript_n
  ang$ 160:-Angle_from_horizontal
  A\$ 161:-A_grave
  A^$ 162:-A_circumflex
  E\$ 163:-E_grave
  E^$ 164:-E_circumflex
  E..$ 165:-E_umlaut
  I^$ 166:-I_circumflex
  I..$ 167:-I_umlaut
  /$ 168:-acute
  \$ 169:-grave
  ^ 170:-circumflex
  ..$ 171:_umlaut
  ~ 172:-tilde
  u\$ 173:-u_grave
  u^$ 174:-u_circumflex
  pnd$ 175:-UK_pounds
  - 176:-High_underscore
  v/$ 177:-v_acute
  y/$ 178:-y_acute
  deg$ 179:-Degree_symbol
  C,$ 180
  c,$ 181
  Nv$ 182
  n~$ 183:-n_tilde
  i 184:-Italic_i
  ?$ 185:-Inverted_?
  XO$ 186
  pnd2$ 187:-pound,only_1_bar
  YT$ 188
  sect$ 189:-Section_mark
  f 190:-Italic_f
  c|$ 191:-
  a^$ 192:-a_circumflex
  e^$ 193:-e_circumflex
  o^$ 194:-o_circumflex
  u^$ 195:-u_circumflex
  a/$ 196:-a_acute
  e/$ 197:-e_acute
  o/$ 198:-o_acute
  u/$ 199:-u_acute
  a\$ 200:-a_grave
  e\$ 201:-e_grave
  o\$ 202:-o_grave
  u\$ 203:-u_grave
  a..$ 204:-a_umlaut
  e..$ 205:-e_umlaut
  o..$ 206:-o_umlaut
  u..$ 207:-u_umlaut
  Ao$ 208:-
  i^$ 209:-i_circumflex
  /O$ 210:-Greek_PHI
  AE$ 211:-
  ao$ 212:-
  i/$ 213:-i_acute
  /o$ 214:-Greek_phi
  /x$ 215:-
  A 216:-A_umlaut
  i\$ 217:-i_grave
  U..$ 218:-U_umlaut
  u..$ 219:-u_umlaut
  E/$ 220:-E_acute
  i..$ 221:-i_umlaut
  beta$ 222:-Greek_beta
  o^ 223:-o_circumflex
  A/$ 224:-A_acute
  A~$ 225:-A_tilde
  a~$ 226:-a_tilde
  -D$ 227:-
  delta+$ 228:-
  I/$ 229:-I_acute
  I\$ 230:-I_grave
  o/$ 231:-o_acute
  o\$ 232:-o_grave
  O~$ 233:-O_tilde
  o~$ 234:-o_tilde
  Sv$ 235:-
  sv$ 236:-
  U/$ 237:-U_acute
  Y/$ 238:-Y_acute
  y..$ 239:-y_umlaut
  P 240:-
  |o$ 241:-
  . 242:-Dot
  micro$ 243:-1E-6
  ||$ 244:-
  3/4$ 245:-Fraction_3/4
  - 246:-Long_minus
  1/4$ 247:-Fraction_1/4
  1/2$ 248:-Fraction_1/2
  a_$ 249:-
  o_$ 250:-
  << 251:-Start_program_construct
  [] 252:-Solid_block
  >> 253:-End_program_construct
  +-$ 254:-Plus/minus
  space$ 255:-Blank
  -----------------------------------------------
  HPTABLE.ASC Look-up Table for HPTRANS Programme
  Revision 1.0  27th Feb 1990  jdg@hpqtdla.hp.com
   
  The first  128 lines of  this file  contain two
  strings per line,  representing a look-up table
  to translate 8bit HP28 characters to 7bit ASCII.
  The 128 lines represent character codes 128-255,
  string one is the ASCII replacement string, and
  string two is a description used in a key table.