Annotation of driverkit/libDriver/Kernel/IODisplay.m, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
        !             3:  *
        !             4:  * @APPLE_LICENSE_HEADER_START@
        !             5:  * 
        !             6:  * Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
        !             7:  * Reserved.  This file contains Original Code and/or Modifications of
        !             8:  * Original Code as defined in and that are subject to the Apple Public
        !             9:  * Source License Version 1.1 (the "License").  You may not use this file
        !            10:  * except in compliance with the License.  Please obtain a copy of the
        !            11:  * License at http://www.apple.com/publicsource and read it before using
        !            12:  * this file.
        !            13:  * 
        !            14:  * The Original Code and all software distributed under the License are
        !            15:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
        !            16:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
        !            17:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
        !            18:  * FITNESS FOR A PARTICULAR PURPOSE OR NON- INFRINGEMENT.  Please see the
        !            19:  * License for the specific language governing rights and limitations
        !            20:  * under the License.
        !            21:  * 
        !            22:  * @APPLE_LICENSE_HEADER_END@
        !            23:  */
        !            24: /*     Copyright (c) 1992 NeXT Computer, Inc.  All rights reserved. 
        !            25:  *
        !            26:  * IODisplay.m - Abstract superclass for all IODisplay objects.
        !            27:  *
        !            28:  *
        !            29:  * HISTORY
        !            30:  * 01 Sep 92   Joe Pasqua
        !            31:  *      Created. 
        !            32:  */
        !            33: 
        !            34: #define DRIVER_PRIVATE 1
        !            35: #define KERNEL 1
        !            36: 
        !            37: #import <driverkit/driverTypes.h>
        !            38: #import <driverkit/driverTypesPrivate.h>
        !            39: #import <driverkit/kernelDriver.h>
        !            40: #import        <driverkit/IODisplay.h>
        !            41: #import <driverkit/IODisplayPrivate.h>
        !            42: 
        !            43: @implementation IODisplay
        !            44: 
        !            45: /* Allocate a console support info structure based on this display. This
        !            46:  * structure, and the functions in it, are used to display alert and
        !            47:  * console windows.
        !            48:  */
        !            49: - (IOConsoleInfo *)allocateConsoleInfo;
        !            50: {
        !            51:     return (IOConsoleInfo *)0;
        !            52: }
        !            53: 
        !            54: - (port_t)devicePort
        !            55: {
        !            56:     return [[self deviceDescription] devicePort];
        !            57: }
        !            58: 
        !            59: 
        !            60: - hideCursor: (int)token;
        !            61: {
        !            62:     return self;
        !            63: }
        !            64: 
        !            65: - moveCursor:(Point*)cursorLoc frame:(int)frame token:(int)t;
        !            66: {
        !            67:     return self;
        !            68: }
        !            69: 
        !            70: - showCursor:(Point*)cursorLoc frame:(int)frame token:(int)t;
        !            71: {
        !            72:     return self;
        !            73: }
        !            74: 
        !            75: - setBrightness:(int)level token:(int)t;
        !            76: {
        !            77:     return self;
        !            78: }
        !            79: 
        !            80: /* Return a pointer to an IODisplayInfo describing the display.
        !            81:  */
        !            82: - (IODisplayInfo *)displayInfo;
        !            83: {
        !            84:     return &_display;
        !            85: }
        !            86: 
        !            87: /* Return the registration token for this display.
        !            88:  */
        !            89: - (int)token;
        !            90: {
        !            91:     return _token;
        !            92: }
        !            93: 
        !            94: /* Set the token for this display.
        !            95:  */
        !            96: - (void)setToken:(int)token;
        !            97: {
        !            98:     _token = token;
        !            99: }
        !           100: 
        !           101: - (IOReturn)getIntValues:(unsigned int *)parameterArray
        !           102:                forParameter:(IOParameterName)parameterName
        !           103:                count:(unsigned int *)count
        !           104: {
        !           105:     unsigned maxCount;
        !           106: 
        !           107:     maxCount = *count;
        !           108:     if (strcmp(parameterName, IO_GET_DISPLAY_PORT) == 0
        !           109:        || strcmp(parameterName, "IO_Display_GetPort") == 0) {
        !           110: 
        !           111:         port_t kernPort, userPort;
        !           112: 
        !           113:        if (maxCount < IO_GET_DISPLAY_PORT_SIZE)
        !           114:            return IO_R_INVALID_ARG;
        !           115:        kernPort = [self devicePort];
        !           116:        userPort = IOConvertPort(kernPort, IO_KernelIOTask, IO_CurrentTask);
        !           117:        parameterArray[0] = (unsigned)userPort;
        !           118:        *count = 1;
        !           119:        return IO_R_SUCCESS;
        !           120:     } else {
        !           121:        return [super getIntValues:parameterArray 
        !           122:            forParameter:parameterName
        !           123:            count:count];
        !           124:     }
        !           125: }
        !           126: 
        !           127: - (IOReturn)getCharValues:(unsigned char *)parameterArray
        !           128:        forParameter:(IOParameterName)parameterName
        !           129:        count:(unsigned int *)count
        !           130: {
        !           131:     IOConfigTable *configTable;
        !           132:     const char *value;
        !           133:     unsigned int length;
        !           134: 
        !           135:     configTable = [[self deviceDescription] configTable];
        !           136:     if (configTable != nil) {
        !           137:        value = [configTable valueForStringKey:parameterName];
        !           138:        if (value != 0) {
        !           139:            length = strlen(value) + 1;
        !           140:            if (length <= *count) {
        !           141:                strcpy(parameterArray, value);
        !           142:                *count = length;
        !           143:                return IO_R_SUCCESS;
        !           144:            }
        !           145:        }
        !           146:     }
        !           147:     return [super getCharValues:parameterArray 
        !           148:        forParameter:parameterName
        !           149:        count:count];
        !           150: }
        !           151: @end

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.