Files
mars-nwe/include/core/wio.h
2026-06-13 22:37:09 +02:00

301 lines
8.2 KiB
C

/****************************************************************************
|
| (C) Copyright 1985, 1991, 1993, 1996 Novell, Inc.
| All Rights Reserved.
|
| This program is free software; you can redistribute it and/or
| modify it under the terms of version 2 of the GNU General Public
| License as published by the Free Software Foundation.
|
| This program is distributed in the hope that it will be useful,
| but WITHOUT ANY WARRANTY; without even the implied warranty of
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
| GNU General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with this program; if not, contact Novell, Inc.
|
| To contact Novell about this file by physical or electronic mail,
| you may find current contact information at www.novell.com
|
|***************************************************************************
|
| NetWare Advance File Services (NSS) module
|
|---------------------------------------------------------------------------
|
| $Author: vandana $
| $Date: 2006-04-28 04:43:14 +0530 (Fri, 28 Apr 2006) $
|
| $RCSfile$
| $Revision: 1361 $
|
|---------------------------------------------------------------------------
| This module is used to:
| NSS Library file
|
| WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!
|
| This header file should ONLY be used for NSS internal development.
| This includes Semantic Agents (SA) and Loadable Storage Services (LSS).
| Any other use may cause conflicts which NSS will NOT fix.
+-------------------------------------------------------------------------*/
#ifndef _WIO_H_
#define _WIO_H_
#ifndef _ZOMNI_H_
# include <zOmni.h>
#endif
#ifndef _STDARG_H_
# include <stdarg.h>
#endif
#ifndef _XSTDIO_H_
# include <xStdio.h>
#endif
#ifndef __linux__
#ifndef _LATCH_H_
# include <latch.h>
#endif
#ifndef _REGISTER_H_
# include <register.h>
#endif
#ifndef _QUE_H_
# include <que.h>
#endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __linux__
typedef struct WFile_s
{// FixFixFix(Linux) - Kludge - remove this item
int WF_NotUsed;
} WFile_s;
/* Linux userspace port: the NSS Linux path only supports console output. */
#define wStdin ((WFile_s *)0)
#define wStdout ((WFile_s *)0)
#define KEY_ENTER 0343 // TODO: From ncurses remove after DEMO
#define NSS_TYPE_OF_KEY_NORMAL 0
#define NSS_TYPE_OF_KEY_MOVE_2 1 // Move cursor for yes no prompt
#define NSS_TYPE_OF_KEY_YES_OR_NO 2
int NSS_wgetch( int typeOfKey );
int NSS_UI_vprintf(unsigned attr, const char *format, va_list args );
void NSS_UI_CreateProcEntries(void);
void NSS_UI_RemoveProcEntries(void);
extern struct file_operations fops_nssui;
#endif
#ifndef __linux__
/*-------------------------------------------------------------------------
* WFile structure definition. This is allocated and returned when WOPEN
* is called.
*-------------------------------------------------------------------------*/
typedef struct WFile_s
{
DQlink_t link; /* linked list of open windows*/
struct ScreenStruct *screenID; /* screen ID of window*/
NINT flags;
NINT pauseLimit; /* if non-zero, we are pausing and this
* defines the line to pause at*/
NINT curPauseLine; /* current line we are writing (0 based)*/
NINT curLineLength; /* length of the current line*/
BYTE *pauseBuffer; /* buffer to hold formatted data*/
ADDR keyWaitThread; /* thread waiting for KEY press*/
Latch_s latch; /* used to single thread multiple IOs
* to the same screen*/
Latch_s groupedIOlatch; /* used to sync a group of I/O requests
* to the same screen so they come out
* together*/
} WFile_s;
#endif
#define WFLAGS_SCREEN_EXTERNAL 0x00000001 /* if SET, the SCREENID is
* external so do not close it*/
#define WFLAGS_CLOSING_SCREEN 0x00000002 /* if SET, we are closing the
* screen, cleanup*/
#define WFLAGS_NOLATCH_IO 0x00000004 /* if SET, do not latch I/O for
* the screen */
#define WFLAGS_READLINE_PENDING 0x00000008 /* if SET, a READLINE is pending
* on the screen*/
#define WPAUSE_BUFFER_SIZE 4064
/*-------------------------------------------------------------------------
* Function prototypes for INTERNAL routines
*-------------------------------------------------------------------------*/
extern STATUS LB__wioInit(void);
extern void LB__wioUninit(void);
extern WFile_s *LB__wioCreateWFile(
struct ScreenStruct *,
NINT flags);
extern void LB__wioDeleteWFile(
WFile_s *);
extern void LB__wioOutput(
WFile_s *,
unsigned,
const char *,
va_list);
/*-------------------------------------------------------------------------
* support macros
*-------------------------------------------------------------------------*/
#define GET_SCREENID(wfile) \
((((wfile) == NULL) || ((wfile)->screenID == NULL)) ? \
COMN_Resource.consoleScreenID : (wfile)->screenID)
/*========================================================================
*========================================================================
* Public defintions that may be used
*========================================================================
*========================================================================*/
#if zLINUX
//extern spinlock_t consoleLock;
extern struct semaphore consoleSema;
#endif
/*-------------------------------------------------------------------------
* Standard IO definitions
*-------------------------------------------------------------------------*/
#ifndef __linux__
#define wStdin COMN_Resource.stdio
#define wStdout COMN_Resource.stdio
#endif
/*-------------------------------------------------------------------------
* Function prototypes
*-------------------------------------------------------------------------*/
extern void LB_wActivate(
WFile_s *file);
extern void LB_wAPrintf(
WFile_s *file,
NINT attr,
const char *formatStr,
...);
extern void LB_wCenter(
WFile_s *file,
const char *str,
...);
extern void LB_wClearScreen(
WFile_s *wfile);
extern void LB_wClose(
WFile_s *file);
extern int LB_wGetc(
WFile_s *file);
extern void LB_wGetDimensions(
WFile_s *file,
NINT *height,
NINT *width);
extern char *LB_wGets(
WFile_s *file,
char *buf);
extern void LB_wGetPos(
WFile_s *file,
NINT *row,
NINT *col);
extern WFile_s *LB_wOpen(
const char *screenName,
NINT flags);
#define WOPEN_NOACTIVATE 0x00000001 /* if SET don't activate screen on OPEN*/
extern NINT LB_wPause(
WFile_s *file,
NINT length);
extern void LB_wPrintf(
WFile_s *file,
const char *__format,
...);
extern BOOL LB_wPromptForYesOrNo(
WFile_s *file,
BOOL defaultResponse,
BOOL responseIfCantRead,
char *promptText);
extern void LB_wSetPos(
WFile_s *file,
NINT row,
NINT col);
extern WFile_s *LB_wSetStdio(
WFile_s *file);
extern void LB_wSyncToInputCursor(
WFile_s *file);
extern void LB_wVPrintf(
WFile_s *file,
const char *format,
va_list args);
extern void LB_wLock(
WFile_s *file);
extern void LB_wUnlock(
WFile_s *file);
extern void LB_wWrapString(
WFile_s *file,
NINT attr,
NINT wrapColumn,
char *string);
/*-------------------------------------------------------------------------
*
*-------------------------------------------------------------------------*/
#define wActivate(p1) LB_wActivate(p1)
#define wAPrintf LB_wAPrintf
#define wCenter LB_wCenter
#define wClearScreen(p1) LB_wClearScreen(p1)
#define wClose(p1) LB_wClose(p1)
#define wGetc(p1) LB_wGetc(p1)
#define wGetDimensions(p1,p2,p3) LB_wGetDimensions(p1,p2,p3)
#ifdef __linux_
// FixFixFix(Linux) - after DEMO this needs to use ncurses and moved to user space
#define wGets(p1,p2) jjj = dsksd(); // Lets get compile errors if this is used in demo
#endif
#if zNETWARE
#define wGets(p1,p2) LB_wGets(p1,p2)
#endif
#define wGetPos(p1,p2,p3) LB_wGetPos(p1,p2,p3)
#define wOpen(p1,p2) LB_wOpen(p1,p2)
#define wPause(p1,p2) LB_wPause(p1,p2)
#define wPrintf LB_wPrintf
#define wSetPos(p1,p2,p3) LB_wSetPos(p1,p2,p3)
#define wSetStdio(p1) LB_wSetStdio(p1)
#define wSyncToInputCursor(p1) LB_wSyncToInputCursor(p1)
#define wVPrintf(p1,p2,p3) LB_wVPrintf(p1,p2,p3)
#define wLock(p1) LB_wLock(p1)
#define wUnlock(p1) LB_wUnlock(p1)
#ifdef __cplusplus
}
#endif
#endif