Q43436: Accessing Predefined Switches in C-Extension
Article: Q43436
Product(s): See article
Version(s): 1.02 | 1.02
Operating System(s): MS-DOS | OS/2
Keyword(s): ENDUSER | FindSwitch | mspl13_basic
Last Modified: 17-MAY-1989
When writing a C extension for Microsoft Editor Version 1.02, you can
access the predefined editor switches through the function
FindSwitch(). FindSwitch() is intended to be used to access the values
of the predefined editor switches, not to modify the values. Modifying
the switches through FindSwitch() has undefined results.
The following code fragment retrieves the value of the switch
"tabstops" for use in your C extension:
#include "ext.h"
.
.
.
PSWI pTabStops ;
int nTabStops ;
.
.
.
pTabStops = FindSwitch ("tabstops") ;
nTabStops = *(pTabStops->act.ival) ;
Any change to the value of the switch "tabstops" made outside your
C extension will be reflected in the value of nTabStops inside your
C extension.
You can find the FindSwitch() prototype in the include file EXT.H. The
function FindSwitch() is not available in the Microsoft Editor Version
1.00.
The structure, swiTable, consists of a series of structures, each
structure describing a user-defined switch. The purpose of swiTable is
to add user-defined, not predefined, switches. It is incorrect to name
the predefined switches in the switch table. For that reason the
following example is incorrect as it names "tabstops," a predefined
switch:
struct swiDesc swiTable [] =
{
{"tabstops", &nTabStops, NUMERIC | RADIX10} /* INCORRECT */
{ NULL, NULL, 0}
} ;
Do not modify the predefined switches through the switch table. You
can change the values of the predefined switches from within an
editing session or in TOOLS.INI.
THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.
Copyright Microsoft Corporation 1986-2002.