qxl_kbt_to_data

Descripción del contenido de la página

Programa herramienta escrito en SBASIC para extraer el contenido de una tabla de teclado de QXL.

Etiquetas:

Escribí este programa herramienta para preparar los datos de una tabla de teclado de la tarjeta QXL en formato de líneas DATA, para incorporarlas al programa Transkeyer.

Código fuente

    1 rem qxl_kb_to_data

    5 rem Copyright (C) 2011 Marcos Cruz (http://programandala,net)
    6 rem License: http://programandala.net/license

    7 rem This tool program is written in SBASIC;
    8 rem it reads data extracted from a QXL keyboard table
    9 rem and creates a SuperBASIC file with the corresponding DATA lines,
   10 rem ready to be used by the program Transkeyer.

   11 rem The source code of this program uses the ISO 8859-1 charset.

   12 rem 2011-02-19 First version.
   13 rem 2011-02-20 Little changes.

   13 let keyboard_table_file$ = "dos1_sb_gentabla_qxl_gb_kbt_data" : rem raw data extracted from the QXL keyboard table
   14 let data_lines_file$ = "dos1_sb_transkeyer_data_bas"

   15 usage : stop

   16 def proc usage
   17   cls
   18   csize 2,1
   19   print "qxl_kb_to_data"
   20   csize 0,0
   21   print \"commands:"\\
   22   print "usage"
   23   print "by_block"
   24   print "by_pc_key"
   25   print "by_pc_key_group (the format needed by Transkeyer)"
   26 end def

   27 def proc by_block

   28   rem Create DATA lines grouped by block.

   29   rem 2011-02-19 First version.
   30   rem 2011-02-20 Rem lines added or completed in the output file.

   31   loc block%,row%,column%,byte%
   32   loc input_channel%,output_channel%

   33   let input_channel% = fop_in(keyboard_table_file$)
   34   if input_channel%<0: report input_channel% : stop
   35   let output_channel% = fop_over(data_lines_file$)
   36   if output_channel%<0: report output_channel% : stop

   37   for block% = 0 to 3
   38     print #output_channel%,\\"rem block"!block%;": QL chars ";
   39     sel on block%
   40       on block% = 0
   41         print #output_channel%,"with normal keystroke";
   42       on block% = 1
   43         print #output_channel%,"with Control";
   44       on block% = 2
   45         print #output_channel%,"with Shift";
   46       on block% = 3
   47         print #output_channel%,"with Control and Shift";
   48     end sel
   49     print #output_channel%,", for every PC XT key code"
   50     for row% = 0 to 7
   51       print #output_channel%,\"data ";
   52       for column% = 0 to 15
   53         bget #input_channel%,byte%
   54         print #output_channel%,datum$(iso_char%(byte%));","(to column%<15);
   55       end for column%
   56     end for row%
   57   end for block%
   58   close #input_channel%, #output_channel%
   59   print \"Done by block."

   60 end def

   61 def proc by_pc_key

   62   rem Create one DATA line for every PC key code.

   63   rem 2011-02-19 First version.
   64   rem 2011-02-20 Rem lines added in the output file.

   65   loc key_code%
   66   loc keyboard_table_address,output_channel%

   67   keyboard_table_address = alchp(flen(\keyboard_table_file$))
   68   lbytes keyboard_table_file$, keyboard_table_address

   69   let output_channel% = fop_over(data_lines_file$)
   70   if output_channel%<0: report output_channel% : stop

   71   pc_key_data_format
   72   for key_code% = 1 to 128
   73     key_code_data(key_code%)
   74   end for key_code%

   75   close #output_channel%
   76   rechp keyboard_table_address
   77   print \"Done by key code."

   78 end def

   79 def proc by_pc_key_group

   80   rem Create one DATA line for every PC key code, grouped by layout.

   81   rem 2011-02-19 First version.
   82   rem 2011-02-20 Rem lines added in the output file.

   83   loc key_code%
   84   loc keyboard_table_address,output_channel%

   85   keyboard_table_address = alchp(flen(\keyboard_table_file$))
   86   lbytes keyboard_table_file$, keyboard_table_address

   87   let output_channel% = fop_over(data_lines_file$)
   88   if output_channel%<0: report output_channel% : stop
   89   pc_key_data_format
   90   print #output_channel%,\"rem Esc-F10 row"
   91   for key_code% = 1, 59 to 68
   92     key_code_data(key_code%)
   93   end for key_code%
   94   print #output_channel%,\\"rem Top row"
   95   for key_code% = 41, 2 to 13, 43, 14
   96     key_code_data(key_code%)
   97   end for key_code%
   98   print #output_channel%,\\"rem Second row"
   99   for key_code% = 15 to 27
  100     key_code_data(key_code%)
  101   end for key_code%
  102   print #output_channel%,\\"rem Third row"
  103   for key_code% = 58,30 to 40,28
  104     key_code_data(key_code%)
  105   end for key_code%
  106   print #output_channel%,\\"rem Fourth row"
  107   for key_code% = 42,86,44 to 54
  108     key_code_data(key_code%)
  109   end for key_code%
  110   print #output_channel%,\\"rem Bottom row"
  111   for key_code% = 29,59,57,56,29
  112     key_code_data(key_code%)
  113   end for key_code%
  114   print #output_channel%,\\"rem Odd pad"
  115   for key_code% = 55,70,69,114,103,105,115,111,113
  116     key_code_data(key_code%)
  117   end for key_code%
  118   print #output_channel%,\\"rem Cursor pad"
  119   for key_code% = 104,107,112,109
  120     key_code_data(key_code%)
  121   end for key_code%
  122   print #output_channel%,\\"rem Numeric pad"
  123   for key_code% = 133,55,74,71 to 73,75 to 83, 124
  124     key_code_data(key_code%)
  125   end for key_code%
  126   print #output_channel%,\\"rem Numeric pad without Num Lock"
  127   for key_code% = 106,103 to 105,107 to 115
  128     key_code_data(key_code%)
  129   end for key_code%

  130   close #output_channel%
  131   rechp keyboard_table_address
  132   print \"Done by key code group."

  133 end def

  134 def proc pc_key_data_format

  135   rem 2011-02-20

  136   print #output_channel%,\"rem Every DATA line has five data:"
  137   print #output_channel%,"rem 1) PC XT key code"
  138   print #output_channel%,"rem 2) QL char"
  139   print #output_channel%,"rem 3) QL char with Shift"
  140   print #output_channel%,"rem 4) QL char with Control"
  141   print #output_channel%,"rem 5) QL char with Shift and Control"

  142 end def

  143 def proc key_code_data(key_code%)

  144   rem Create one DATA line for a PC key code.

  145   rem 2011-02-19 First version.

  146   loc byte%,key_code$,block%

  147   let key_code$ = "00"&key_code%
  148   print #output_channel%,\"data ";key_code$(len(key_code$)-2 to);",";
  149   for block% = 0 to 3
  150     let byte% = iso_char%(peek(keyboard_table_address+block%*128+key_code%))
  151     print #output_channel%,datum$(byte%);","(to block%<3);
  152   end for block%

  153 end def

  154 def fn datum$(iso_char%)

  155   rem Return the ISO 8859-1 char code in proper format for the DATA line.

  156   rem 2011-02-19 First version.

  157   sel on iso_char%
  158     on iso_char% = 0 to 31,34,92
  159       return "chr$("&iso_char%&")"
  160     on iso_char% = remainder
  161       return '"'&chr$(iso_char%)&'"'
  162   end sel

  163 end def

  164 def fn iso_char%(ql_char%)

  165   rem Return the equivalent ISO 8859-1 char code of a QL char code, or zero.

  166   rem 2011-02-19 First version.

  167   sel on ql_char%
  168     on ql_char% =  45 : return 173 : rem soft hyphen (SHY)
  169     on ql_char% =  96 : return 163 : rem pound sign
  170     on ql_char% = 0 to 126 : return ql_char%
  171     on ql_char% =  127 : return 169 : rem copyright sign
  172     on ql_char% =  128 : return 228 : rem a with diaeresis
  173     on ql_char% =  129 : return 227 : rem a with tilde
  174     on ql_char% =  130 : return 229 : rem a with ring
  175     on ql_char% =  131 : return 233 : rem e with acute
  176     on ql_char% =  132 : return 246 : rem o with diaeresis
  177     on ql_char% =  133 : return 245 : rem o with tilde
  178     on ql_char% =  134 : return 248 : rem o with stroke
  179     on ql_char% =  135 : return 252 : rem u with diaeresis
  180     on ql_char% =  136 : return 231 : rem c with cedilla
  181     on ql_char% =  137 : return 241 : rem n with tilde
  182     on ql_char% =  138 : return 230 : rem ae
  183     on ql_char% =  139 : return 0 : rem oe doesn't exist in ISO 8859-1
  184     on ql_char% =  140 : return 225 : rem a with acute
  185     on ql_char% =  141 : return 224 : rem a with grave
  186     on ql_char% =  142 : return 226 : rem a with circumflex
  187     on ql_char% =  143 : return 235 : rem e with diaeresis
  188     on ql_char% =  144 : return 232 : rem e with grave
  189     on ql_char% =  145 : return 234 : rem e with circumflex
  190     on ql_char% =  146 : return 239 : rem i with diaeresis
  191     on ql_char% =  147 : return 237 : rem i with acute
  192     on ql_char% =  148 : return 236 : rem i with grave
  193     on ql_char% =  149 : return 238 : rem i with circumflex
  194     on ql_char% =  150 : return 243 : rem o with acute
  195     on ql_char% =  151 : return 242 : rem o with grave
  196     on ql_char% =  152 : return 244 : rem o with circumflex
  197     on ql_char% =  153 : return 250 : rem u with acute
  198     on ql_char% =  154 : return 249 : rem u with grave
  199     on ql_char% =  155 : return 251 : rem u with circumflex
  200     on ql_char% =  156 : return 223 : rem sharp s
  201     on ql_char% =  157 : return 162 : rem cent sign
  202     on ql_char% =  158 : return 165 : rem yen sign
  203     on ql_char% =  159 : return 96 : rem grave accent
  204     on ql_char% =  160 : return 196 : rem A with diaeresis
  205     on ql_char% =  161 : return 195 : rem A with tilde
  206     on ql_char% =  162 : return 197 : rem A with ring
  207     on ql_char% =  163 : return 201 : rem E with acute
  208     on ql_char% =  164 : return 214 : rem O with diaeresis
  209     on ql_char% =  165 : return 213 : rem O with tilde
  210     on ql_char% =  166 : return 216 : rem O with stroke
  211     on ql_char% =  167 : return 220 : rem U with diaeresis
  212     on ql_char% =  168 : return 199 : rem C with cedilla
  213     on ql_char% =  169 : return 209 : rem N with tilde
  214     on ql_char% =  170 : return 198 : rem AE
  215     on ql_char% =  171 : return 0 : rem OE doesn't exist in ISO 8859-1
  216     on ql_char% = 172 to 175, 177, 178  : return 0 : rem greek letters don't exist in ISO 8859-1
  217     on ql_char% =  176 : return 181 : rem micro sign
  218     on ql_char% =  179 : return 161 : rem inverted exclamation mark
  219     on ql_char% =  180 : return 191 : rem inverted question mark
  220     on ql_char% = 181 : return 0 : rem char 181 doesn't exist in ISO 8859-1
  221     on ql_char% =  182 : return 167 : rem section sign
  222     on ql_char% =  183 : return 164 : rem currency sign
  223     on ql_char% =  184 : return 171 : rem left-pointing double angle quotation mark
  224     on ql_char% =  185 : return 187 : rem right-pointing double angle quotation mark
  225     on ql_char% =  186 : return 176 : rem degree sign
  226     on ql_char% =  187 : return 247 : rem division sign
  227     on ql_char% = 188 to 191 : return 0 : rem arrows don't exist in ISO 8859-1
  228     on ql_char% = remainder : return 0
  229   end sel

  230 end def


Descargas

Páginas relacionadas

Transkeyer
Programa escrito en SBASIC para crear una tabla de teclado de SMSQ/E para un teclado de PC en castellano y juego de caracteres ISO 8859-1.
gentabla2
Programa en SuperBASIC para castellanizar una tabla de teclado de QXL.
Transfonter
Utilidad escrita en SBASIC para crear un juego de caracteres para QL con el estándar ISO 8859-1.