Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

ascii2enUS_scancode.cpp

Go to the documentation of this file.
00001 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
00002  * vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=c:cindent:textwidth=0:
00003  *
00004  * Copyright (C) 2005 Dell Inc.
00005  *  by Michael Brown <Michael_E_Brown@dell.com>
00006  * Licensed under the Open Software License version 2.1
00007  *
00008  * Alternatively, you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published
00010  * by the Free Software Foundation; either version 2 of the License,
00011  * or (at your option) any later version.
00012 
00013  * This program is distributed in the hope that it will be useful, but
00014  * WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00016  * See the GNU General Public License for more details.
00017  */
00018 
00019 // compat header should always be first header if including system headers
00020 #define LIBSMBIOS_SOURCE
00021 #include "smbios/compat.h"
00022 
00023 #include <string.h>
00024 
00025 #include "smbios/SystemInfo.h"
00026 
00027 //--------------------------------------------------------------------
00028 // Global Data Area
00029 //--------------------------------------------------------------------
00030 // maps ASCII number to a scan code
00031 // sorted by ASCII value
00032 static const char ascMap[256] =
00033     {
00034         0x03,
00035         0x1E,
00036         0x30,
00037         0x46,
00038         0x20,
00039         0x12,
00040         0x21,
00041         0x22,
00042         0x0E,
00043         0x0F,
00044         0x1C,
00045         0x25,
00046         0x26,
00047         0x1C,
00048         0x31,
00049         0x18,
00050         0x19,
00051         0x10,
00052         0x13,
00053         0x1F,
00054         0x14,
00055         0x16,
00056         0x2F,
00057         0x11,
00058         0x2D,
00059         0x15,
00060         0x2C,
00061         0x1A,
00062         0x2B,
00063         0x1B,
00064         0x07,
00065         0x0C,
00066         0x39,
00067         0x02,
00068         0x28,
00069         0x04,
00070         0x05,
00071         0x06,
00072         0x08,
00073         0x28,
00074         0x0A,
00075         0x0B,
00076         0x09,
00077         0x0D,
00078         0x33,
00079         0x0C,
00080         0x34,
00081         0x35,
00082         0x0B,
00083         0x02,
00084         0x03,
00085         0x04,
00086         0x05,
00087         0x06,
00088         0x07,
00089         0x08,
00090         0x09,
00091         0x0A,
00092         0x27,
00093         0x27,
00094         0x33,
00095         0x0D,
00096         0x34,
00097         0x35,
00098         0x03,
00099         0x1E,
00100         0x30,
00101         0x2E,
00102         0x20,
00103         0x12,
00104         0x21,
00105         0x22,
00106         0x23,
00107         0x17,
00108         0x24,
00109         0x25,
00110         0x26,
00111         0x32,
00112         0x31,
00113         0x18,
00114         0x19,
00115         0x10,
00116         0x13,
00117         0x1F,
00118         0x14,
00119         0x16,
00120         0x2F,
00121         0x11,
00122         0x2D,
00123         0x15,
00124         0x2C,
00125         0x1A,
00126         0x2B,
00127         0x1B,
00128         0x07,
00129         0x0C,
00130         0x29,
00131         0x1E,
00132         0x30,
00133         0x2E,
00134         0x20,
00135         0x12,
00136         0x21,
00137         0x22,
00138         0x23,
00139         0x17,
00140         0x24,
00141         0x25,
00142         0x26,
00143         0x32,
00144         0x31,
00145         0x18,
00146         0x19,
00147         0x10,
00148         0x13,
00149         0x1F,
00150         0x14,
00151         0x16,
00152         0x2F,
00153         0x11,
00154         0x2D,
00155         0x15,
00156         0x2C,
00157         0x1A,
00158         0x2B,
00159         0x1B,
00160         0x29,
00161         0x0E,
00162         0x00,
00163         0x00,
00164         0x00,
00165         0x00,
00166         0x00,
00167         0x00,
00168         0x00,
00169         0x00,
00170         0x00,
00171         0x00,
00172         0x00,
00173         0x00,
00174         0x00,
00175         0x00,
00176         0x00,
00177         0x00,
00178         0x00,
00179         0x00,
00180         0x00,
00181         0x00,
00182         0x00,
00183         0x00,
00184         0x00,
00185         0x00,
00186         0x00,
00187         0x00,
00188         0x00,
00189         0x00,
00190         0x00,
00191         0x00,
00192         0x00,
00193         0x00,
00194         0x00,
00195         0x00,
00196         0x00,
00197         0x00,
00198         0x00,
00199         0x00,
00200         0x00,
00201         0x00,
00202         0x00,
00203         0x00,
00204         0x00,
00205         0x00,
00206         0x00,
00207         0x00,
00208         0x00,
00209         0x00,
00210         0x00,
00211         0x00,
00212         0x00,
00213         0x00,
00214         0x00,
00215         0x00,
00216         0x00,
00217         0x00,
00218         0x00,
00219         0x00,
00220         0x00,
00221         0x00,
00222         0x00,
00223         0x00,
00224         0x00,
00225         0x00,
00226         0x00,
00227         0x00,
00228         0x00,
00229         0x00,
00230         0x00,
00231         0x00,
00232         0x00,
00233         0x00,
00234         0x00,
00235         0x00,
00236         0x00,
00237         0x00,
00238         0x00,
00239         0x00,
00240         0x00,
00241         0x00,
00242         0x00,
00243         0x00,
00244         0x00,
00245         0x00,
00246         0x00,
00247         0x00,
00248         0x00,
00249         0x00,
00250         0x00,
00251         0x00,
00252         0x00,
00253         0x00,
00254         0x00,
00255         0x00,
00256         0x00,
00257         0x00,
00258         0x00,
00259         0x00,
00260         0x00,
00261         0x00,
00262         0x00,
00263         0x00,
00264         0x00,
00265         0x00,
00266         0x00,
00267         0x00,
00268         0x00,
00269         0x00,
00270         0x00,
00271         0x00,
00272         0x00,
00273         0x00,
00274         0x00,
00275         0x00,
00276         0x00,
00277         0x00,
00278         0x00,
00279         0x00,
00280         0x00,
00281         0x00,
00282         0x00,
00283         0x00,
00284         0x00,
00285         0x00,
00286         0x00,
00287         0x00,
00288         0x00,
00289         0x00
00290     };
00291 
00292 //---------------------------------------------------------------------
00293 // KBDMapASCIIToScanCode - Maps a string of ASCII codes to scan code
00294 // bytes
00295 //---------------------------------------------------------------------
00296 void SMBIOSMapAsciiTo_en_US_ScanCode(char *outputScanCodeBuf, const char *inputAsciiBuf, size_t outputBufSize)
00297 {
00298     memset(outputScanCodeBuf, 0, outputBufSize);
00299     for (size_t i = 0; i<outputBufSize && i<strlen(inputAsciiBuf); i++)
00300     {
00301         outputScanCodeBuf[i] = ascMap[static_cast<size_t>(inputAsciiBuf[i])];
00302     }
00303 }
00304 

Generated on Wed Apr 11 16:25:09 2007 for SMBIOS Library by doxygen 1.3.5