Back to index

lightning-sunbird  0.9+nobinonly
Functions | Variables
mac_console.c File Reference
#include "mac_console.h"
#include <console.h>

Go to the source code of this file.

Functions

short InstallConsole (short fd)
void RemoveConsole (void)
long WriteCharsToConsole (char *buffer, long n)
long ReadCharsFromConsole (char *buffer, long n)

Variables

CWPluginContext gPluginContext
UInt32 mac_console_count = 0
CWMemHandle mac_console_handle = NULL

Function Documentation

short InstallConsole ( short  fd)

Definition at line 64 of file mac_console.c.

{
#pragma unused (fd)
       mac_console_count = 0;
       CWAllocMemHandle(gPluginContext, 8192, false, &mac_console_handle);
       return 0;
}
long ReadCharsFromConsole ( char *  buffer,
long  n 
)

Definition at line 136 of file mac_console.c.

{
       return 0;
}

Definition at line 81 of file mac_console.c.

long WriteCharsToConsole ( char *  buffer,
long  n 
)

Definition at line 101 of file mac_console.c.

{
       long size = 0;
       void* ptr = NULL;

       if (CWGetMemHandleSize(gPluginContext, mac_console_handle, &size) == noErr) {
              if (mac_console_count + n >= size) {
                     size += 8192;
                     if (CWResizeMemHandle(gPluginContext, mac_console_handle, size) != noErr)
                            return -1;
              }
       }

       if (CWLockMemHandle(gPluginContext, mac_console_handle, false, &ptr) == noErr) {
              BlockMoveData(buffer, (char *)ptr + mac_console_count, n);
              mac_console_count += n;
              CWUnlockMemHandle(gPluginContext, mac_console_handle);
       }
       
       return 0;
}

Variable Documentation

CWPluginContext gPluginContext

Definition at line 82 of file mac_xpidl.cpp.

Definition at line 45 of file mac_console.c.

CWMemHandle mac_console_handle = NULL

Definition at line 46 of file mac_console.c.