[C++ Error] Caculater.cpp(21): E2141 Declaration syntax error

pythonpowered 2005-05-26 04:17:02
提示出问题的地方我用注释标记了20行处

//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop
#include <math.h>
#include <stdio.h>
#include "Caculater.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
int temp1;
float temp2;
int flag;
//---------------------------------------------------------------------------

__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
void__fastcall TForm1::FormCreate(TObject*Sender)/*这里提示出问题*/
{
Form1->Edit1->Clear();
temp1=0;
temp2=0;
flag=0;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button2Click(TObject *Sender)
{
Form1->Edit1->Text=Form1->Edit1->Text+Form1->Button2->Caption;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button4Click(TObject *Sender)
{
Form1->Edit1->Text=Form1->Edit1->Text+Form1->Button4->Caption;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button12Click(TObject *Sender)
{
form1->edit1->clear();
temp1=0;
temp2=0;
flag=0;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button1Click(TObject *Sender)
{
Form1->Edit1->Text=Form1->Edit1->Text+Form1->Button1->Caption;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button3Click(TObject *Sender)
{
Form1->Edit1->Text=Form1->Edit1->Text+Form1->Button3->Caption;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button5Click(TObject *Sender)
{
Form1->Edit1->Text=Form1->Edit1->Text+Form1->Button5->Caption;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button6Click(TObject *Sender)
{
Form1->Edit1->Text=Form1->Edit1->Text+Form1->Button6->Caption;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button7Click(TObject *Sender)
{
Form1->Edit1->Text=Form1->Edit1->Text+Form1->Button7->Caption;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button8Click(TObject *Sender)
{
Form1->Edit1->Text=Form1->Edit1->Text+Form1->Button8->Caption;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button9Click(TObject *Sender)
{
Form1->Edit1->Text=Form1->Edit1->Text+Form1->Button9->Caption;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button10Click(TObject *Sender)
{
Form1->Edit1->Text=Form1->Edit1->Text+Form1->Button10->Caption;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button13Click(TObject *Sender)
{
flag=1;
Temp1=StrToInt(Form1->Edit1->text);
Form1->Edit1->Clear();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button11Click(TObject *Sender)
{
Switch(flag)
{
case 1:temp2=StrToFloat(Edit1->text)+StrToFloat(temp1);
break;
case 2:temp2=StrToFloat(Edit1->text)-StrToFloat(temp1);
break;
case 3:temp2=StrToFloat(Edit1->text)*StrToFloat(temp1);
break;
case 4:temp2=StrToFloat(Edit1->text)/StrToFloat(temp1);
break;
}
Edit1->text=FloatToStr(temp2);

}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button14Click(TObject *Sender)
{
flag=2;
Temp1=StrToInt(Form1->Edit1->text);
Form1->Edit1->Clear();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button15Click(TObject *Sender)
{
flag=3;
Temp1=StrToInt(Form1->Edit1->text);
Form1->Edit1->Clear();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button16Click(TObject *Sender)
{
flag=4;
Temp1=StrToInt(Form1->Edit1->text);
Form1->Edit1->Clear();
}
//---------------------------------------------------------------------------
...全文
270 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
铖邑 2005-05-28
  • 打赏
  • 举报
回复
嗨,写代码该小心点啊
cumtjianbolu 2005-05-27
  • 打赏
  • 举报
回复
'form1'大哥form1该大写啊!
setdefault 2005-05-26
  • 打赏
  • 举报
回复
[C++ Error] Caculater.cpp(22): E2316 '_fastcall TForm1::FormCreate(TObject *)' is not a member of 'TForm1'
///在 .h文件中的TForm1类__Published下面加入void __fastcall FormCreate(TObject *Sender);

[C++ Error] Caculater.cpp(44): E2451 Undefined symbol 'form1'
///form1 改为Form1 C++builder大小写敏感
[C++ Error] Caculater.cpp(94): E2451 Undefined symbol 'Temp1'
///Temp1 改为temp1 C++builder大小写敏感

[C++ Error] Caculater.cpp(94): E2316 'text' is not a member of 'TEdit'
///text 改为Text C++builder大小写敏感

[C++ Error] Caculater.cpp(100): E2268 Call to undefined function 'Switch'
///Switch 改为switch , C++builder大小写敏感
[C++ Error] Caculater.cpp(101): E2379 Statement missing ;
[C++ Error] Caculater.cpp(118): E2451 Undefined symbol 'Temp1'
///同前
[C++ Error] Caculater.cpp(118): E2316 'text' is not a member of 'TEdit'
///同前
[C++ Error] Caculater.cpp(125): E2451 Undefined symbol 'Temp1'
///同前
[C++ Error] Caculater.cpp(125): E2316 'text' is not a member of 'TEdit'
///同前
[C++ Error] Caculater.cpp(132): E2451 Undefined symbol 'Temp1'
///同前
[C++ Error] Caculater.cpp(132): E2316 'text' is not a member of 'TEdit'
///同前
pythonpowered 2005-05-26
  • 打赏
  • 举报
回复
又出现了如下问题,如何解决呢
[C++ Error] Caculater.cpp(22): E2316 '_fastcall TForm1::FormCreate(TObject *)' is not a member of 'TForm1'
[C++ Error] Caculater.cpp(44): E2451 Undefined symbol 'form1'
[C++ Error] Caculater.cpp(94): E2451 Undefined symbol 'Temp1'
[C++ Error] Caculater.cpp(94): E2316 'text' is not a member of 'TEdit'
[C++ Error] Caculater.cpp(100): E2268 Call to undefined function 'Switch'
[C++ Error] Caculater.cpp(101): E2379 Statement missing ;
[C++ Error] Caculater.cpp(118): E2451 Undefined symbol 'Temp1'
[C++ Error] Caculater.cpp(118): E2316 'text' is not a member of 'TEdit'
[C++ Error] Caculater.cpp(125): E2451 Undefined symbol 'Temp1'
[C++ Error] Caculater.cpp(125): E2316 'text' is not a member of 'TEdit'
[C++ Error] Caculater.cpp(132): E2451 Undefined symbol 'Temp1'
[C++ Error] Caculater.cpp(132): E2316 'text' is not a member of 'TEdit'
铖邑 2005-05-26
  • 打赏
  • 举报
回复
void后面少了一个空格
Welcome to Turbo C++ Version 3.0 -------------------------------- This README file contains important information about Turbo C++. For the latest information about Turbo C++ and its accompanying programs and manuals, read this file in its entirety. TABLE OF CONTENTS ----------------- 1. How to Get Help 2. Installation 3. Features 4. Important Information 5. Testing Your Expanded Memory 6. Corrections to the On-line Help 1. HOW TO GET HELP ------------------- If you have any problems, please read this file, the HELPME!.DOC and other files in your DOC subdirectory, and the Turbo C++ manuals first. If you still have a question and need assistance, help is available from the following sources: 1. Type GO BPROGB on the CompuServe bulletin board system for instant access to the Borland forums with their libraries of technical information and answers to common questions. If you are not a member of CompuServe, see the enclosed special offer, and write for full details on how to receive a free IntroPak containing a $15 credit toward your first month's on-line charges. 2. Check with your local software dealer or users' group. 3. Borland's TECHFAX service. Call (800) 822-4269 for a FAX catalog of entries. 4. If you have an urgent problem that cannot wait and you have sent in the license agreement that came with the package, you may call the Borland Technical Support Department at (408) 438-5300. Please have the following information ready before calling: a. Product name and serial number on your original distribution disk. Please have your serial number ready or we will be unable to process your call. b. Product version number. The version number for Turbo C++ can be displayed by pressing Alt-H/A. c. Computer brand, model, and the brands and model numbers of any additional hardware. d. Operating system and version number. (The version number can be determined by typing VER at the DOS prompt.) e. Contents of your AUTOEXEC.BAT file. f. Contents of your CONFIG.SYS file. 2. INSTALLATION ---------------- You MUST use the INSTALL program to install Turbo C++. The files on the distribution disks are all archived and have to be properly assembled. You cannot do this by hand! IMPORTANT! If you want to create backup copies of your disks, make sure that you put the backup on the same type of disk as the source. If you're backing up the 5 1/4 inch 1.2 Mb disk set, use only blank 5 1/4 inch 1.2 Mb disks for backup, etc. The installation will not work correctly if you do not use the same media type for the backup disks. To start the installation, change your current drive to the one that has the install program on it and type INSTALL. You will be given instructions in a box at the bottom of the screen for each prompt. For example, if you will be installing from drive A:, type: A: INSTALL - This INSTALL handles the installation of both the compiler and tools in one operation, and allows several new configuration options. - After installation, make sure you insert \TC\BIN - or whatever you selected as your BIN directory - into your DOS path so the executable files can be found. - Note: The list of files is contained in a separate file called FILELIST.DOC, which will appear in the target directory you specify during installation. - After your initial installation, you can run INSTALL again to add elements you omitted the first time. Just select the items you want to add in the INSTALL options screen. Because some things you may want to save could be overwritten, review the following items to make sure you don't lose important information: 1. Selecting CMD (the Command-line compiler) causes an overwrite of any existing turboc.cfg & tlink.cfg file with path information provided in that INSTALL session. Any switches other than -L (library path) and -I (include path) will not be preserved. 2. Selecting IDE will reset the include and library paths to those provided in that INSTALL session. 3. By selecting any one of the following, the help file paths and choices for THELP.CFG will reflect the current session's installation choices: a. CMD - command-line compiler b. IDE - integrated environment 4. Alterations to headers or startup files will be overwritten if any library models are selected. In general, any selection you make of something installed earlier will cause an overwrite of the earlier version without prompting. You should read the rest of this README file to get further information about this release before you do the installation. 3. FEATURES ------------ Turbo C++ 3.0 includes big speed and capacity gains. Here are some important features found in this version: - DPMI services for increased capacity - C++ 2.1 support, including the new nested class specifications, and support of C++ 3.0 templates. - Support for pre-compiled headers for substantial time savings during subsequent recompiles. - Color syntax highlighting - Unlimited Undo/Redo replacing previous 'restore line' capability - Added library functions for compatibility with other runtime libraries, and addition of support for long double parameters in math functions. (Please refer to On-line Help for details.) - New MAKE features. (Please see the MAKE chapter in the User's Guide for details.) - Added BGI (Borland Graphics Interface) fonts and support. (See "New BGI fonts" below.) - A resident DPMI kernel program, DPMIRES.EXE. (See "DPMI" below.) - THELP now allows you to switch between help files without unloading and reloading. (Please see UTIL.DOC for details.) NEW BGI FONTS ------------- Several new fonts have been added to the Borland Graphics Interface: Name Value Description ------------------------------------------- SCRIPT_FONT 5 Stroked script font SIMPLEX_FONT 6 Stroked simplex font TRIP_SCR_FONT 7 Stroked triplex script font COMPLEX_FONT 8 Stroked complex font EURO_FONT 9 Stroked European font BOLD_FONT 10 Stroked bold font The fonts in the BGI now support the full ASCII character set. DPMI ---- TC.EXE, TCC.EXE, and TLINK.EXE are now hosted under DPMI. These files support protected-mode compilation and replace the files of the same name in Turbo C++ Second Edition. Turbo C++ Second Edition should continue to be used in instances where real-mode compilation is desired. If you encounter a "machine not in database" message while attempting to run the compiler, run the DPMIINST program to add your machine configuration to the DPMI server database. This version includes a resident DPMI host program, DPMIRES.EXE, that allows you to preload the server before invoking TC, TCC, or any other DPMI-hosted executables. If you want to run such hosted EXEs in a Windows Standard Mode DOS window, you should run DPMIRES.EXE before loading Windows. To do this, enter the following commands at DOS: set DPMIMEM=MAXMEM 2000 dpmires win /s If you want to limit the amount of extended memory used by the DPMI-hosted executables, an environment variable called DPMIMEM can be set to do so. For instance, the command set DPMIMEM=MAXMEM 2000 reserves about 2 Mb of memory for DPMIRES. The number after MAXMEM can be adjusted, but cannot be lower than 1000. The hosted executables cannot spawn each other when SHARE is loaded. For instance, if you run MAKE on a file which in turn calls MAKE again, you will get a sharing violation. In this specific case, you can call the real mode version, MAKER, within the given makefile, and a sharing violation won't occur. 4. IMPORTANT INFORMATION ------------------------- - When using Brief with THELP, make sure to use Brief's -p switch to ensure that the thelp window will be visible. - We recommend that you use the following mouse drivers with this product: Microsoft Mouse version 7.04 or later; Logitech Mouse version 5.01 or later; Genius Mouse version 9.06 or later. - If you get a "floating point formats not linked" message at runtime, put the following somewhere in your source files: extern void _floatconvert(); #pragma extref _floatconvert This will force inclusion of floating point formats, which may not be linked to reduce executable size. COMPILER - The default extension for source files to the command-line compiler is .CPP; that is, if you enter TCC -c test the compiler will search for test.cpp, and give an error if a file of that name cannot be found. If you want to have the command-line compiler assume a .c extension and C language source, use the command-line option -P-c. For more information, see "The command-line compiler" in the User's Guide. - Note that the Generate COMDEFs choice under Options|Compiler|Advanced Code Generation and the -Fc command- line option are only supported in the C language. Linker errors will result if you attempt to use a communal variable in C++. - The macros min() and max() are not defined when stdlib.h is compiled as C++ (to allow their use in 3rd party libraries, etc.). - Note that SYMDEB creates .SYM files for use in debugging; Turbo C++ creates .SYM files for pre-compiled headers. They are not compatible and collisions should be avoided by setting the name of the pre-compiled header file (using - H=filename). - There is now full support of distance modifiers (near and far) used for class member pointers. Here are two sample declarations and their meanings: void (A::* far var) (); this is a far variable 'var' of type 'void (A::*)()'; void (far A::* var) (); this is a 'default distance' variable 'var' of type 'void (far A::*)()' - If you use C++ templates, and use a separate TLINK command line rather than letting TCC invoke TLINK, you should make sure that you turn on case-sensitive links with the /c switch. - Incorrect code will be generated if you have a statement of the type "A op B" where either A or B is an enum and the other operand is a long, and "op" is one of the following operators: += -= *= /= | ^ The same problem applies when the operands are a non-integer enum and an int. Cast the enum to long or int respectively to solve the problem. IDE - When debugging a mouse application the Options|Debugger|Display Swapping option should be set to "Always" for best results. - In the IDE, the mouse cursor is turned off during compilation for performance improvements. - To run or debug an overlaid application in the IDE when DOS SHARE is loaded, the .EXE file must first be marked as read-only. Otherwise, unload SHARE. - Pressing Control-Break twice while running or stepping a program from the IDE may cause unexpected results. In particular, avoid pressing Control-Break twice in response to any function requiring input (scanf, getch, etc.). To break out of a program during such interaction, press Control-Break and enter a valid input string. Control will be returned to the IDE. EXAMPLE PROGRAMS - When you are running any example programs that come with .PRJ files, if you didn't use the standard directories when you installed Turbo C++ you will have to change the .PRJ file to reflect your actual directory setup. Do this from inside Turbo C++ with Alt-O/D. LINKING C++ WITH C - Linking C++ modules with C modules requires the use of a linkage specification. Prototypes for C functions within C++ modules must be in one of the following forms: extern "C" declaration extern "C" { declarations } For example, if a C module contains these functions: char *SCopy(char*, char*); void ClearScreen(void) they must be declared in a C++ module in one of the following ways: extern "C" char *SCopy(char*, char*); extern "C" void ClearScreen(void); or extern "C" { char *SCopy(char*, char*); void ClearScreen(void); } Failure to do so will result in "Undefined symbol" errors during link. For further examples, see the standard header files. CLASS LIBRARY - Two versions of the class libraries are provided; one that includes debug information and one that does not. Small versions of each are provided, and project files are provided to build other models. Note that the non-debug versions are used by default. If you would like to use the debug version, copy it to the non-debug file. For instance, in the CLASSLIB\LIB directory, copy TCLASDBS.LIB to TCLASSS.LIB for the small model version. - In some places the User's Guide incorrectly refers to the online documentation for the Container Class Libraries as CONTAIN.DOC. The correct file name is CLASSLIB.DOC, located in the ..\DOC directory. 5. TESTING YOUR EXPANDED MEMORY: EMSTEST.COM --------------------------------------------- Included with Turbo C++ is a program to test your Expanded Memory hardware and software. If you have problems using Turbo C++ with your EMS, type EMSTEST at the DOS prompt and follow the instructions. 6. CORRECTIONS TO THE ON-LINE HELP ----------------------------------- The information for alloca is not available in on-line help. The correct help screen should read as follows: ------------------------------------------------------------------ Function: alloca Allocates temporary stack space Syntax: #include void *alloca(size_t size); Remarks: alloca allocates bytes on the stack. The allocated space is automatically freed up when the calling function exits. Return value: o On success (if enough stack space is available), returns a pointer to the allocated stack area. o On error, returns null. Argument size is the number of bytes allocated on the stack. Because alloca modifies the stack pointer, do no place calls to alloca in an expression that is an argument to a function. NOTE: If the calling function does not contain any references to local variables in the stack, the stack won't be resotored correctly when the function exits and your program will crash. To ensure that the stack is restored correctly, use this code in your calling function: char *p; char dummy[1]; dummy[0] := 0;; ... p = alloca(nbytes); Because alloca is not defined in ANSI C, you should use malloc instead. See also: malloc ------------------------------------------------------------------
Welcome to Turbo C++ Version 3.0 -------------------------------- This README file contains important information about Turbo C++. For the latest information about Turbo C++ and its accompanying programs and manuals, read this file in its entirety. TABLE OF CONTENTS ----------------- 1. How to Get Help 2. Installation 3. Features 4. Important Information 5. Testing Your Expanded Memory 6. Corrections to the On-line Help 1. HOW TO GET HELP ------------------- If you have any problems, please read this file, the HELPME!.DOC and other files in your DOC subdirectory, and the Turbo C++ manuals first. If you still have a question and need assistance, help is available from the following sources: 1. Type GO BPROGB on the CompuServe bulletin board system for instant access to the Borland forums with their libraries of technical information and answers to common questions. If you are not a member of CompuServe, see the enclosed special offer, and write for full details on how to receive a free IntroPak containing a $15 credit toward your first month's on-line charges. 2. Check with your local software dealer or users' group. 3. Borland's TECHFAX service. Call (800) 822-4269 for a FAX catalog of entries. 4. If you have an urgent problem that cannot wait and you have sent in the license agreement that came with the package, you may call the Borland Technical Support Department at (408) 438-5300. Please have the following information ready before calling: a. Product name and serial number on your original distribution disk. Please have your serial number ready or we will be unable to process your call. b. Product version number. The version number for Turbo C++ can be displayed by pressing Alt-H/A. c. Computer brand, model, and the brands and model numbers of any additional hardware. d. Operating system and version number. (The version number can be determined by typing VER at the DOS prompt.) e. Contents of your AUTOEXEC.BAT file. f. Contents of your CONFIG.SYS file. 2. INSTALLATION ---------------- You MUST use the INSTALL program to install Turbo C++. The files on the distribution disks are all archived and have to be properly assembled. You cannot do this by hand! IMPORTANT! If you want to create backup copies of your disks, make sure that you put the backup on the same type of disk as the source. If you're backing up the 5 1/4 inch 1.2 Mb disk set, use only blank 5 1/4 inch 1.2 Mb disks for backup, etc. The installation will not work correctly if you do not use the same media type for the backup disks. To start the installation, change your current drive to the one that has the install program on it and type INSTALL. You will be given instructions in a box at the bottom of the screen for each prompt. For example, if you will be installing from drive A:, type: A: INSTALL - This INSTALL handles the installation of both the compiler and tools in one operation, and allows several new configuration options. - After installation, make sure you insert \TC\BIN - or whatever you selected as your BIN directory - into your DOS path so the executable files can be found. - Note: The list of files is contained in a separate file called FILELIST.DOC, which will appear in the target directory you specify during installation. - After your initial installation, you can run INSTALL again to add elements you omitted the first time. Just select the items you want to add in the INSTALL options screen. Because some things you may want to save could be overwritten, review the following items to make sure you don't lose important information: 1. Selecting CMD (the Command-line compiler) causes an overwrite of any existing turboc.cfg & tlink.cfg file with path information provided in that INSTALL session. Any switches other than -L (library path) and -I (include path) will not be preserved. 2. Selecting IDE will reset the include and library paths to those provided in that INSTALL session. 3. By selecting any one of the following, the help file paths and choices for THELP.CFG will reflect the current session's installation choices: a. CMD - command-line compiler b. IDE - integrated environment 4. Alterations to headers or startup files will be overwritten if any library models are selected. In general, any selection you make of something installed earlier will cause an overwrite of the earlier version without prompting. You should read the rest of this README file to get further information about this release before you do the installation. 3. FEATURES ------------ Turbo C++ 3.0 includes big speed and capacity gains. Here are some important features found in this version: - DPMI services for increased capacity - C++ 2.1 support, including the new nested class specifications, and support of C++ 3.0 templates. - Support for pre-compiled headers for substantial time savings during subsequent recompiles. - Color syntax highlighting - Unlimited Undo/Redo replacing previous 'restore line' capability - Added library functions for compatibility with other runtime libraries, and addition of support for long double parameters in math functions. (Please refer to On-line Help for details.) - New MAKE features. (Please see the MAKE chapter in the User's Guide for details.) - Added BGI (Borland Graphics Interface) fonts and support. (See "New BGI fonts" below.) - A resident DPMI kernel program, DPMIRES.EXE. (See "DPMI" below.) - THELP now allows you to switch between help files without unloading and reloading. (Please see UTIL.DOC for details.) NEW BGI FONTS ------------- Several new fonts have been added to the Borland Graphics Interface: Name Value Description ------------------------------------------- SCRIPT_FONT 5 Stroked script font SIMPLEX_FONT 6 Stroked simplex font TRIP_SCR_FONT 7 Stroked triplex script font COMPLEX_FONT 8 Stroked complex font EURO_FONT 9 Stroked European font BOLD_FONT 10 Stroked bold font The fonts in the BGI now support the full ASCII character set. DPMI ---- TC.EXE, TCC.EXE, and TLINK.EXE are now hosted under DPMI. These files support protected-mode compilation and replace the files of the same name in Turbo C++ Second Edition. Turbo C++ Second Edition should continue to be used in instances where real-mode compilation is desired. If you encounter a "machine not in database" message while attempting to run the compiler, run the DPMIINST program to add your machine configuration to the DPMI server database. This version includes a resident DPMI host program, DPMIRES.EXE, that allows you to preload the server before invoking TC, TCC, or any other DPMI-hosted executables. If you want to run such hosted EXEs in a Windows Standard Mode DOS window, you should run DPMIRES.EXE before loading Windows. To do this, enter the following commands at DOS: set DPMIMEM=MAXMEM 2000 dpmires win /s If you want to limit the amount of extended memory used by the DPMI-hosted executables, an environment variable called DPMIMEM can be set to do so. For instance, the command set DPMIMEM=MAXMEM 2000 reserves about 2 Mb of memory for DPMIRES. The number after MAXMEM can be adjusted, but cannot be lower than 1000. The hosted executables cannot spawn each other when SHARE is loaded. For instance, if you run MAKE on a file which in turn calls MAKE again, you will get a sharing violation. In this specific case, you can call the real mode version, MAKER, within the given makefile, and a sharing violation won't occur. 4. IMPORTANT INFORMATION ------------------------- - When using Brief with THELP, make sure to use Brief's -p switch to ensure that the thelp window will be visible. - We recommend that you use the following mouse drivers with this product: Microsoft Mouse version 7.04 or later; Logitech Mouse version 5.01 or later; Genius Mouse version 9.06 or later. - If you get a "floating point formats not linked" message at runtime, put the following somewhere in your source files: extern void _floatconvert(); #pragma extref _floatconvert This will force inclusion of floating point formats, which may not be linked to reduce executable size. COMPILER - The default extension for source files to the command-line compiler is .CPP; that is, if you enter TCC -c test the compiler will search for test.cpp, and give an error if a file of that name cannot be found. If you want to have the command-line compiler assume a .c extension and C language source, use the command-line option -P-c. For more information, see "The command-line compiler" in the User's Guide. - Note that the Generate COMDEFs choice under Options|Compiler|Advanced Code Generation and the -Fc command- line option are only supported in the C language. Linker errors will result if you attempt to use a communal variable in C++. - The macros min() and max() are not defined when stdlib.h is compiled as C++ (to allow their use in 3rd party libraries, etc.). - Note that SYMDEB creates .SYM files for use in debugging; Turbo C++ creates .SYM files for pre-compiled headers. They are not compatible and collisions should be avoided by setting the name of the pre-compiled header file (using - H=filename). - There is now full support of distance modifiers (near and far) used for class member pointers. Here are two sample declarations and their meanings: void (A::* far var) (); this is a far variable 'var' of type 'void (A::*)()'; void (far A::* var) (); this is a 'default distance' variable 'var' of type 'void (far A::*)()' - If you use C++ templates, and use a separate TLINK command line rather than letting TCC invoke TLINK, you should make sure that you turn on case-sensitive links with the /c switch. - Incorrect code will be generated if you have a statement of the type "A op B" where either A or B is an enum and the other operand is a long, and "op" is one of the following operators: += -= *= /= | ^ The same problem applies when the operands are a non-integer enum and an int. Cast the enum to long or int respectively to solve the problem. IDE - When debugging a mouse application the Options|Debugger|Display Swapping option should be set to "Always" for best results. - In the IDE, the mouse cursor is turned off during compilation for performance improvements. - To run or debug an overlaid application in the IDE when DOS SHARE is loaded, the .EXE file must first be marked as read-only. Otherwise, unload SHARE. - Pressing Control-Break twice while running or stepping a program from the IDE may cause unexpected results. In particular, avoid pressing Control-Break twice in response to any function requiring input (scanf, getch, etc.). To break out of a program during such interaction, press Control-Break and enter a valid input string. Control will be returned to the IDE. EXAMPLE PROGRAMS - When you are running any example programs that come with .PRJ files, if you didn't use the standard directories when you installed Turbo C++ you will have to change the .PRJ file to reflect your actual directory setup. Do this from inside Turbo C++ with Alt-O/D. LINKING C++ WITH C - Linking C++ modules with C modules requires the use of a linkage specification. Prototypes for C functions within C++ modules must be in one of the following forms: extern "C" declaration extern "C" { declarations } For example, if a C module contains these functions: char *SCopy(char*, char*); void ClearScreen(void) they must be declared in a C++ module in one of the following ways: extern "C" char *SCopy(char*, char*); extern "C" void ClearScreen(void); or extern "C" { char *SCopy(char*, char*); void ClearScreen(void); } Failure to do so will result in "Undefined symbol" errors during link. For further examples, see the standard header files. CLASS LIBRARY - Two versions of the class libraries are provided; one that includes debug information and one that does not. Small versions of each are provided, and project files are provided to build other models. Note that the non-debug versions are used by default. If you would like to use the debug version, copy it to the non-debug file. For instance, in the CLASSLIB\LIB directory, copy TCLASDBS.LIB to TCLASSS.LIB for the small model version. - In some places the User's Guide incorrectly refers to the online documentation for the Container Class Libraries as CONTAIN.DOC. The correct file name is CLASSLIB.DOC, located in the ..\DOC directory. 5. TESTING YOUR EXPANDED MEMORY: EMSTEST.COM --------------------------------------------- Included with Turbo C++ is a program to test your Expanded Memory hardware and software. If you have problems using Turbo C++ with your EMS, type EMSTEST at the DOS prompt and follow the instructions. 6. CORRECTIONS TO THE ON-LINE HELP ----------------------------------- The information for alloca is not available in on-line help. The correct help screen should read as follows: ------------------------------------------------------------------ Function: alloca Allocates temporary stack space Syntax: #include void *alloca(size_t size); Remarks: alloca allocates bytes on the stack. The allocated space is automatically freed up when the calling function exits. Return value: o On success (if enough stack space is available), returns a pointer to the allocated stack area. o On error, returns null. Argument size is the number of bytes allocated on the stack. Because alloca modifies the stack pointer, do no place calls to alloca in an expression that is an argument to a function. NOTE: If the calling function does not contain any references to local variables in the stack, the stack won't be resotored correctly when the function exits and your program will crash. To ensure that the stack is restored correctly, use this code in your calling function: char *p; char dummy[1]; dummy[0] := 0;; ... p = alloca(nbytes); Because alloca is not defined in ANSI C, you should use malloc instead. See also: malloc ------------------------------------------------------------------
Release history (reverse chronological order) This release 1.3.7.1 Release date: December 11, 2006 Known bugs: none Fixes/features added from previous release: a) added support for multiple filters per process in VsDrvr.dll b) updated manual Previous release 1.3.5 Release date: October 11th, 2005 Known bugs: none Fixes/features added from previous release a) added VsSetWavelengthStep and VsGetWavelengthStep functions b) added VsSetWavelengthWavesConfirm() function c) fixed error-handling of VsSetWavelength() In earlier revisions, the error status light was cleared after a VsSetWavelength() call failed, so the user did not see the light turn red to alert that an error had occurred. This has been fixed in 1.35 so the error light remains lit, and an error code is returned. d) added range-check to VsDefinePalette() Previous revisions did not range-check the palette index number, and hard crashes could be produced if out-of-range values were supplied to this routine. Previous release 1.33b Release date: February 9, 2005 Known bugs: none Fixes/features changed from previous release: a) Fixed installer: programmers?guide (vsdrvr.pdf) installed when SDK is selected. Previous release 1.33a Release date: January 10th, 2005 Known bugs: i) SDK programmers?guide is not installed even if SDK is selected. Fixes/features added from previous release a) VsDrvr.dll fixed handling of COMx ports that do not support 460kb The autobaud sequence tries a variety of baud rates, some of which are not supported by RS-232 interfaces (but are supported on USB virtual COM ports). This was not handled properly, so if a call was made to VsOpen when no VariSpec was present, but a later call was made when a filter was present, the latter would fail. b) VsGui added check of which COMx ports are present on computer This program now filters its COMx list and only shows ports which actually exist; it used to show COM1 ?COM8 even if not all of these were present. c) VsGui added automatic filter detection on Configure dialog This checks all ports in turn, and reports the first detected filter. The search order is determined by the order in which the computer lists ports in the Registry. d) VsGui changed to recognize filters as present while initializing In prior revisions, VsGui would not report no filter found if a filter was present but still going through its power-up initialization. Now, a message box is posted to indicate that a filter was found, and the program checks whether initialization is complete, at 1 second intervals. When the filter is done initializing, the VsGui controls become active and report the filter information (serial number, wavelength range, etc). e) VsGui added filter status item to Configure dialog Adjacent the COMx combo box, there is now a text field that indicates filter status as 揘ot found? 揑nitializing? or 揜eady? This field is updated whenever the combo box selection is changed. Previous release 1.32 Release date: July 27th, 2004 Known bugs: COMx port described above as 1.33 fix item a) Fixes/features added from previous release a) VsGui added a sweep feature to enable cycling the filter The wavelength start, stop, and step are adjustable. Cycling can be done a fixed number of times or indefinitely. Previous release 1.30 Release date: June 23rd, 2004 Known bugs: none Fixes/features added from previous release a) New commands VsSetWaveplateAndWaves(), VsGetWaveplateAndWaves(), VsGetWaveplateLimits(), and VsGetWaveplateStages() were added for support of variable retarder models. b) New commands VsSetRetries() and VsSetLatencyMs() were added for control of serial port latency and automatic retry in case of error. c) New commands VsSetMode() and VsGetMode() were added for control of the VariSpec filter抯 triggering and sweep modes d) New command VsGetSettleMs() was added to learn optics settling time e) New commands VsIsDiagnostic() and VsIsEngagedInBeam() were added. These are reserved for CRI use and are not supported for use by end users. f) The command syntax and functionality of the VsSendCommand() function was changed - see description of this command for details g) The VsGui program was modified to add sweep function, and the associated files were added to the file manifest. The new functions are assigned higher ordinal numbers than the earlier commands, so the ordinal numbers assigned to routines in the earlier VsDrvr routines are preserved. This means one may use the new VsDrvr.dll file with applications that were developed and linked with the earlier release, without any need to recompile or relink the application. Of course, to use the new functions one must link the application code with the new .lib file containing these functions. Previous release: 1.20 Release date December 3rd, 2003 Known bugs: a) there is a conflict when one uses the implicit palette to set wavelengths, and also defines palette states explicitly using the VsDefinePalette() function. When the explicitly set palette state overwrites a palette state implicitly associated with a certain wavelength, that wavelength will not be accurately set when one issues the VsSetWavelength() command. This is fixed in release 1.30 Fixes/features added from previous release a) fixes bug with implicit palette in September 8 release b) incorporates implicit retry for command send/reply if error in transmission c) recognizes filters with serial numbers > 60000 (normally VariLC numbers) d) supports binary transfer of >127 bytes Previous release 1.11 Release date September 8, 2003 Known bugs a) implicit palette can fail to create palette entry, causing tuning error b) VsSendBinary() fails if 128 chars or more sent (signed char error) Fixes/features added from previous release a) included VsIsPresent() function omitted from function list of 1.10 release Previous release 1.10 Release date: August 28th, 2003 Known bugs: a) VsIsPresent function not included ?generates 搖nresolved external?at link-time Fixes/features added from previous release: b) added command VsEnableImplicitPalette() to code and documentation added command VsConnect() to code and documentation added command VsClose() to code and documentation added local variable to avoid unnecessary querying of diagnostic status documented that command VsConnect() will not be supported in future documented that command VsDisconnect() will not be supported in future documented that command VsIsConnected() will not be supported in future changed to Windows Installer from previous ZIP file added table summary of commands to this manual Previous release 1.00 Release date: November 5th, 2002 Known bugs: a) none Fixes/features added from previous release b) n/a ?initial releaseDescription This package provides a set of functions to control the VariSpec filter, which may be called from C or C++ programs. It incorporates all aspects of the filter communication, including low-level serial routines. With these routines, one can address the filter as a virtual object, with little need for detailed understanding of its behavior. This simplifies the programming task for those who want to integrate the VariSpec into larger software packages. File manifest All files are contained in a single installer file which includes the following: vsdrvr.h declaration file vsdrvr.lib library stub file vsdrvr.dll run-time library vsdrvr_r1p30.pdf (this file) release notes and programmer抯 guide {sample program using VsDrvr package} registryAccess.cpp registryAccess.h resource.h stdafx.h VsConfigDlg.cpp VsConfigfDlg.h VsGui.cpp VsGui.h VsGui.mak VsGui.rc VsGuiDlg.cpp VsGuiDlg.h VsSweep.cpp VsSweep.h Development cycle In order to use the DLL, one should take the following steps: a) Add #include 搗sdrvr.h?statements to all files that access the VariSpec software b) Add vsdrvr.lib to the list of modules searched by the linker c) Place a copy of vsdrvr.dll in either the folder that includes the executable code for the program being developed; or, preferably, in the windows system folder. Failures in step a) will lead to compiler errors; in step b) to linker errors; in step c) to a run-time error message that 揳 required .DLL file, vsdrvr.dll, was not found? VariSpec filter configuration The VariSpec filter communicates via ASCII commands sent over an RS-232 interface or USB. The RS232 can operate at 9600 or 19,200 baud, while the USB appears as a virtual COMx device. While it appears to be present at either 9600 baud or 115.2 kbaud , the actual data transmission occurs at 12 MBaud over the USB. Each command is terminated with an end-of-line terminator which can be either a carriage-return or line feed . For RS-232 models, the baud rate and terminator character are selected using DIP switches inside the VariSpec electronics module. Default settings are 9600 baud, and the character (denoted 慭r?in the C language). For USB devices, the terminator is always . For latest information, or to determine how to alter the settings from the factory defaults, consult the VariSpec manual. Timing and latency The VariSpec filter takes a finite time to process commands, which adds an additional delay to that imposed by simple communication delays. In general, the time to process a given command is short except for the following operations: ?filter initialization ?wavelength selection ?palette definition The first of these is quite lengthy (30 seconds or more) because it involves measurements and exercising of the liquid crystal optics. The latter two are much faster but still can take a significant amount of time (up to 300 ms) on the older RS-232 electronics due to the computations involved. On the newer, USB electronics, the latter two functions are completed in less than 5 ms. For this reason, the functions that handle these actions offer the option of waiting until the action is complete before returning (so-called synchronous operation); although they can be called in an asynchronous mode where the function returns as soon as all commands have been sent to the VariSpec, without waiting for them to run to completion. Another option is to use implicit palette tables. If this is enabled, by calling the VsEnableImplicitPalette() function, the driver will define the settings for a given wavelength once, then saves the results within the VariSpec for faster access next time that wavelength is used. Subsequent access times are essentially instantaneous, until either all of the 128 palette states are in use, or the palette is cleared via the VsClearPalette() command. The VsIsReady() function can be used to determine whether a filter is done processing all commands. Ideally, one should check VsIsReady() using a timer or the like to wait efficiently, so that the host PC is free to do other tasks while waiting for the VariSpec. The VariSpec always processes each command to completion before starting on the next command, and it has a 256 byte input buffer, so there is no problem issuing several commands at once; they will all be executed, and in the order given. This also indicates another way to coordinate one抯 program with the VariSpec filter: one can issue any of the VsGetxxx() functions, which query the filter. Since these do not return until the filter has responded, one may be sure that there are no pending commands when the VsGetxxx() function completes. The VsDrvr package provides for automatic re-try of commands up to 3 times, in the event that communications are garbled, and will wait up to 2 seconds for completion of serial commands. The number of retries can be set from 0 to 10, and the latency adjusted, if desired. However, there should be no need to do so. The hardware and software have been tested and observed to execute several million commands without a single communications error, so in practice the need for the retry protocol is very slight. Communication speed is not improved by reducing the latency, since commands proceed when all characters are received, and the latency time to time-out is only relevent when there is a communications lapse ?and as noted, these are very unlikely so the performance burden of retries should not be a practical consideration. Multiple Filters and Multiple Processes These routines only permit one VariSpec per process, and one process per VariSpec. So, these routines cannot control multiple filters at once from a single process; nor can several active processes seek to control the same filter at the same time. The VsDrvr package anticipates a future upgrade to enable control of multiple filters per process, so it makes use of an integer handle to identify which VariSpec is being controlled, even though (for now) only a single filter can be active. This handle is checked, and the correct handle must be used in all calls. Program flow and sequence Typical programs should use the following API calls (all applications, upon initiating link to the filter) ?call VsOpen() to establish communications link (required) ?call VsIsPresent() to confirm a filter is actually present ?call VsIsReady() in case filter is still doing power-up sequence ?call VsGetFilterIdentity() to learn wavelength limits and serial number if needed (if setting wavelengths via implicit palettes; recommended especially with older filters) ?call VsEnableImplicitPalettes() ? (to set wavelengths, either directly or via implicit palettes) ?call VsSetWavelength() and VsGetWavelength() to select and retrieve tuning (if setting wavelengths by means of palettes, and managing palettes explicity) ?call VsDefinePaletteEntry() and VsClearPalette() to define palette entries ?call VsSetPalette() and VsGetPalette() to select and retrieve palette state (all applications, when done with the filter) ?call VsClose() to release the communications link (required) Sample program Source code for a sample program, VsGui, is provided, which illustrates how to control a VariSpec filter using the VsDrvr package. All filter control code lives in the VsGuiDlg.cpp module, specifically in the Connect(), RequestToSetWavelength(), and VsWriteTimerProc() functions. The latter two use a system timer to decouple the GUI from the actual filter control, for more responsive feedback to the user. Such an approach is unnecessary if palettes are used, which is preferable when one wishes the best real-time performance. See the VariSpec manual for further information. Auxiliary commands Certain commands are normally only used at the factory when filters are being built and configured, or in specialized configurations. These appear after the normal command set in the listing below. Obsolescent commands The VsConnect(), VsIsConnected(), and VsDisconnect() functions are obsolescent. They are supported in this release, but will not necessarily exist in releases after 1.3x. As they are obsolescent, they are not recommended for new code. These function calls are not documented further in this manual.Summary of commands Normal Commands VsClearError(vsHnd) VsClearPalette(vsHnd) VsClearPendingCommands(vsHnd) VsClose(vsHnd) VsDefinePalette(vsHnd, palEntry, wl) VsEnableImplicitPalette(vsHnd, isEnabled) VsGetError(vsHnd, *pErr) VsGetFilterIdentity(vsHnd, *pVer, *pSerno, *pminWl, *pmaxWl) VsGetMode(vsHnd, int *pMode) VsGetPalette(vsHnd, *ppalEntryNo) VsGetSettleMs(vsHnd, *psettleMs) VsGetTemperature(vsHnd, *pTemperature) VsGetWavelength(vsHnd, *pwl) VsGetWavelengthAndWaves(vsHnd, double *pWl, double *pwaves) VsGetWaveplateLimits(vsHnd, double *pminWaves, double *pmaxWaves) VsGetWaveplateStages(vsHnd, int *pnStages) VsIsPresent(vsHnd) VsIsReady(vsHnd) VsOpen(*pvsHnd, portName, *pErrorCode) VsSetLatencyMs(vsHnd, nLatencyMs) VsSetMode(vsHnd, mode) VsSetPalette(vsHnd, palEntry) VsSetRetries(vsHnd, nRetries) VsSetWavelength(vsHnd, wl, confirm) VsSetWavelengthAndWaves(vsHnd, wl, waveplateVector) Auxiliary commands VsGetAllDrive(vsHnd, *pStages, drive[]) VsGetNstages(vsHnd, *pStages) VsGetPendingReply(vsHnd, reply, nChars, *pQuit, firstMs, subsequentMs) VsGetReply(vsHnd, reply, nChars, waitMs) VsIsDiagnostic(vsHnd) VsIsEngagedInBeam(vsHnd) VsSendBinary(vsHnd, bin[], nChars, clearEcho) VsSendCommand(vsHnd, cmd, sendEolChar) VsSetStageDrive(vsHnd, stage, drive) VsThermistorCounts(vsHnd, *pCounts) Alphabetical list of function calls Syntax Throughout this manual, the following conventions are used: VSDRVR_API Int32 VsOpen( VS_HANDLE *vsHnd, LPCSTR port, Int32 *pErrorCode ) Bold text is used for function names Italics indicate variables whose names (or values) are supplied by the user in their code Name-mangling The declaration file vsdrvr.h includes statements that render the API names accurately in a C++ environment, i.e. free of the name-mangling decoration suffix that is normally added by C++ compilers. Thus the functions can be called freely from either C or C++ programs, using the names exactly as shown in this manual or in the VsDrvr.h file. Call and argument declarations The call protocol type, VSDRVR_API, is declared in vsdrvr.h, as are the types Int32 and VS_HANDLE. Errors All functions return an Int32 status value, which is TRUE if the routine completed successfully and FALSE if there was an error. If there is an error in the VsOpen() function, the error is returned in *pErrorCode. If there is an error in communicating with a filter after a successful VsOpen(), one should use the VsGetError() function to obtain the specific error code involved. This function returns VSD_ERR_NOERROR if there is no error pending. Main and auxiliary functions The next section provides a description of the main functions, in alphabetic order; followed by the auxiliary functions, also in alphabetical order. In normal use, one will probably have no need for the auxiliary functions, but this list is provided for completeness. VSDRVR_API Int32 VsClearError( VS_HANDLE vsHnd ) Arguments: vsHnd handle value returned by VsOpen() Purpose: this function clears any pending error on the VariSpec. This resets the error LED on the filter, and sets the pending error to VS_ERR_NOERROR. Returns: TRUE if successful, FALSE otherwise Notes: noneVSDRVR_API Int32 VsClearPalette( VS_HANDLE vsHnd ) Arguments: vsHnd handle value returned by VsOpen() Function: clears all elements of the current filter palette and renders the current palette element undefined. Returns: TRUE if successful, FALSE otherwise Notes: none VSDRVR_API Int32 VsClearPendingCommands( VS_HANDLE vsHnd ) Arguments: vsHnd handle value returned by VsOpen() Function: clears all pending commands including any presently in-process Returns: TRUE if successful, FALSE otherwise Notes: none VSDRVR_API Int32 VsClose( VS_HANDLE vsHnd ) Arguments: vsHnd handle value returned by VsOpen(). May also be NULL, in which case all VariSpec filters are disconnected. Function: Disconnects the filter. Returns: TRUE if successful, FALSE otherwise Notes: No other functions will work until VsOpen() is called to re-establish communications with the filter. VSDRVR_API Int32 VsDefinePalette( VS_HANDLE vsHnd, Int32 palEntry, double wl) Arguments: vsHnd handle value returned by VsOpen() palEntry palette entry to be defined, in the range [0, 127] wl wavelength associated with this palette entry Function: creates a palette entry for the entry and wavelength specified. This palette entry can then be accessed using VsSetPalette() and VsGetPalette() functions. Returns: TRUE if successful, FALSE otherwise Notes: palettes provide a fast way to define filter settings for wavelengths that are to be repeatedly accessed. The calculations are performed once, at the time the palette element is defined, and the results are saved in a palette table to tune to that wavelength without repeating the underlying calculations. And, one may cycle through the palette table, once defined, by means of TTL a trigger signal to the filter electronics. For more information about using palettes, consult the VariSpec user抯 manual. VSDRVR_API Int32 VsEnableImplicitPalette( VS_HANDLE vsHnd, BOOL imlEnabled) Arguments: vsHnd handle value returned by VsOpen() implEnabled selects whether to use implicit palette definition Function: enables or disables implicit palette generation when wavelengths are defined using the VsSetWavelength function. If enabled, a new palette entry is created whenever a new wavelength is accessed, and the VsSetWavelength function will use this palette entry whenever that wavelength is accessed again, until the palette is cleared. The result is improved tuning speed; however, it means that the palette contents are altered dynamically, which can be a problem if one relies upon the palette contents remaining fixed. Clearing the palette with VsClearPalette() will clear all implicit palette entries as well as explicitly defined palette entries. This is useful if one knows that wavelengths used previously will not be used again, or that a new set of wavelengths is about to be defined and one wishes to make sure there is sufficient room in the palette. Returns: TRUE if successful, FALSE otherwise Notes: By default, the implicit palette is enabled for VariSpec filters that have RS-232 interface, and is disabled for newer VariSpec filters that have the USB interface. This is because the newer filters perform the filter tuning calculations fast enough that no performance improvement is obtained by using the implicit palette to set wavelength. For more information about using palettes, consult the VariSpec user抯 manual. VSDRVR_API Int32 VsGetError( VS_HANDLE vsHnd, Int32 *pErr) Arguments: vsHnd handle value returned by VsOpen() pErr pointer to the int that will receive the most recent error code Purpose: this function clears any pending error on the VariSpec. This resets the error LED on the filter, and sets the pending error to VS_ERR_NOERROR. Returns: TRUE if successful, FALSE otherwise Notes: noneVSDRVR_API Int32 VsGetFilterIdentity( VS_HANDLE vsHnd, Int32 *pVer, Int32 *pSerno, double *pminWl, double *pmaxWl ) Arguments: vsHnd handle value returned by VsOpen() pVer pointer to variable that receives the filter firmware version pSerno pointer to variable that receives the filter serial number pminWl pointer to variable that receives the filter抯 minimum wavelength pmaxWl pointer to variable that receives the filter抯 maximum wavelength Purpose: this function reads the filter抯 information using the VariSpec 慥?command, and puts it to the call variables. Any one of the pointers may be NULL, in which case that piece of information is not returned. Returns: TRUE if successful, FALSE otherwise Notes: none VSDRVR_API Int32 VsGetMode( VS_HANDLE vsHnd, Int32 *pMode ) Arguments: vsHnd handle value returned by VsOpen() pMode pointer to variable that receives the filter mode Purpose: this function enables one to read the filter抯 present mode. The mode describes how the filter responds to hardware triggers, and is described in the filter manual. If the pointer *pMode is NULL, no information is returned. Returns: TRUE if successful, FALSE otherwise Notes: none VSDRVR_API Int32 VsGetPalette( VS_HANDLE vsHnd, Int32 *ppalEntry ) Arguments: vsHnd handle value returned by VsOpen() ppalEntry pointer to int that receives the 0-based palette entry number. This pointer may not be NULL. Purpose: this function determines what palette entry is currently active and returns it to *ppalEntry. If the present palette entry is undefined, it sets *ppalEntry to ? and returns a successful status code. Returns: TRUE if successful, FALSE otherwise Notes: noneVSDRVR_API Int32 VsGetSettleMs( VS_HANDLE vsHnd, Int32 *pSettleMs ) Arguments: vsHnd handle value returned by VsOpen() pSettleMs pointer to variable that receives the filter settling time Purpose: this function returns the filter抯 settling time, in milliseconds. This is useful for establishing overall system timing. The settling time is defined as beginning at the moment that the electronics have processed the request to change wavelength, as determined by VsIsReady() or equivalent. At that moment, the new set of drive signals are applied to the optics, and the optics will settle in *psettleMs milliseconds. The settling time is defined as a 95% settling time, meaning the filter has settled to 95% of its ultimate transmission value at the new wavelength being tuned to. Returns: TRUE if successful, FALSE otherwise Notes: none VSDRVR_API Int32 VsGetTemperature( VS_HANDLE vsHnd, double *pTemperature ) Arguments: vsHnd handle value returned by VsOpen() pTemperature pointer to double that will receive the filter temperature, in C This pointer may not be NULL Purpose: this function determines the filter temperature using the VariSpec 慪?command, and puts the result to *pTemperature. Returns: TRUE if successful, FALSE otherwise Notes: noneVSDRVR_API Int32 VsGetWavelength( VS_HANDLE vsHnd, double *pwl ) Arguments: vsHnd handle value returned by VsOpen() pwl pointer to double that will receive the filter wavelength, in nm This pointer may not be NULL Purpose: this function determines the current filter wavelength and returns it to *pwl. If the present wavelength is undefined, it sets *pwl to ? and returns a successful status code. Returns: TRUE if successful, FALSE otherwise Notes: none VSDRVR_API Int32 VsGetWavelengthAndWaves( VS_HANDLE vsHnd, double *pwl, double *pwaves ) Arguments: vsHnd handle value returned by VsOpen() pwl pointer to double that will receive the filter wavelength, in nm. This pointer may not be NULL pwaves pointer to double array that will receive one or more waveplate settings. The actual number of settings may be determined by VsGetWaveplateStages(). Purpose: this function determines the current filter wavelength and returns it to *pwl. If the present wavelength is undefined, it sets *pwl to ? and returns a successful status code. If the present wavelength is defined, it also returns the waves of retardance at each of the polarization analysis waveplates in the optics, in the pwaves[] array. Returns: TRUE if successful, FALSE otherwise Notes: See the description of the VsGetWaveplateStages() command for more detail on what stages are considered waveplates. VSDRVR_API Int32 VsGetWaveplateLimits( VS_HANDLE vsHnd, double *pminWaves, double *pmaxWaves ) Arguments: vsHnd handle value returned by VsOpen() pminWaves pointer to double array that will receive the minimum retardances possible at each of the waveplate stages in the filter optics. pmaxWaves pointer to double array that will receive the maximum retardances possible at each of the waveplate stages in the filter optics Purpose: this function determines the range of retardances that are possible at each waveplate stage, in waves, at the present wavelength setting. Note that the retardance range is itself a function of wavelength, so the results will vary as the wavelength is changed. Returns: TRUE if successful, FALSE otherwise Notes: See the description of the VsGetWaveplateStages command for more detail on what stages are considered waveplates. VSDRVR_API Int32 VsGetWaveplateStages( VS_HANDLE vsHnd, Int32 *pnwpStages ) Arguments: vsHnd handle value returned by VsOpen() pnwpStages pointer to Int32 that will receive the number of waveplate stages in the filter optics. This pointer may not be NULL Purpose: this function determines how many polarization analysis stages are present in the optics and returns this number. Note that although all VariSpec filters operate by means of variable retarder element, optical stages that perform wavelength tuning rather than polarization analysis are not treated as waveplate stages. For example, most VariSpec filters do not include any polarization analysis stages and thus report no waveplates. VsGetWaveplateStages will return a value of 2 for conventional PolScope optics. In contrast, VsGetNstages() reports the total number of stages in a filter, including stages that perform polarization analysis and stages that perform wavelength tuning. Returns: TRUE if successful, FALSE otherwise Notes: none VSDRVR_API Int32 VsIsPresent( VS_HANDLE vsHnd ) Arguments: vsHnd handle value returned by VsOpen() Function: determines whether a filter is actually present and responding. This is done using the status-check character ??as described in the VariSpec manual. Returns: TRUE if successful, FALSE otherwise Notes: none VSDRVR_API Int32 VsIsReady( VS_HANDLE vsHnd ) Arguments: vsHnd handle value returned by VsOpen() Function: determines whether the filter is done processing all commands, and is ready to receive new commands. Returns: TRUE if successful, FALSE otherwise Notes: this is useful when sending commands such as VsSetWavelength(), VsInitialize(), VsExercise(), and VsDefinePaletteEntry() in asynchronous mode. These commands take a prolonged time, and running them synchronously ties up the processor waiting. Alternatively, one can create a loop that uses CreateWaitableTimer(), SetWaitableTimer(), and WaitForSingleObject() to call VsIsReady() at intervals, checking whether the filter is ready. This approach, though more work for the programmer, leaves most of the processor capacity free for other tasks such as GUI update and the like. VSDRVR_API Int32 VsOpen (VS_HANDLE *pvsHnd, LPCSTR port, Int32 *pErrorCode ) Arguments: pvsHnd pointer to handle. This pointer may not be NULL. port port name, such as 揅OM1? pErrorCode pointer to Int32 to receive an error code if VsOpen() fails Purpose: establishes a connection to the VariSpec using the port specified, and automatically determines the baud rate and end-of-line character for subsequent communications. It also retrieves the filter抯 serial number and wavelength range, to confirm that it is a VariSpec and not some other similar device. However, these are retrieved purely as an integrity check, and the values are not returned to the calling application. See VsGetFilterInfo() to access this information. If the device responds as a VariSpec does when it is not ready (i.e. still initializing), VsOpen() fails and returns the error code VSD_ERR_BUSY. However, one may not be sure that the device is a VariSpec until VsOpen() completes successfully The error codes returned by this function are listed in VsDrvr.h. When VsOpen() runs successfully, *pErrorCode is set to VSD_ERR_NOERROR. The handle associated with this filter is set by VsOpen() to a nonzero handle value if successful, or to NULL if no connection is established. The port may refer to COM1 through COM8. Return: TRUE if successful, FALSE otherwise Notes: Until this function is called, none of the other functions will work. VSDRVR_API Int32 VsSetLatency( VS_HANDLE vsHnd, Int32 latencyMs ) Arguments: vsHnd handle value returned by VsOpen() latencyMs the serial port latency, in ms, in the range [1, 5000] Purpose: this function sets the latency time for USB or RS-232 commands to the value given by latencyMs. Commands that do not conclude in this time are considered to have timed-out. Returns: TRUE if successful, FALSE otherwise Notes: increasing the latency time does not increase the time for commands to complete, nor does it insert any delays in normal processing. It merely defines the window for maximum transmission time, beyond which time an error is reported. VSDRVR_API Int32 VsSetPalette( VS_HANDLE vsHnd, Int32 palEntry ) Arguments: vsHnd handle value returned by VsOpen() palEntry the palette entry to be set, in the range [0, 127] Purpose: this function sets the filter to the palette entry specified by palEntry Returns: TRUE if successful, FALSE otherwise Notes: palettes are a good way to control the filter in applications where it will be cycled repeatedly to various, fixed wavelength settings. Palettes calculate the filter settings once, and save the results for rapid access later, rather than calculating them each time, as occurs when one sets the wavelength directly with VsSetWavelength(). See the VariSpec manual for more information on palettes.VSDRVR_API Int32 VsSetRetries( VS_HANDLE vsHnd, Int32 nRetries ) Arguments: vsHnd handle value returned by VsOpen() nRetries the number serial communications retries, in the range [0, 10] Purpose: The VsDrvr software automatically detects errors in communication and re-sends if an error is detected. This function sets the number of times to retry sending any single command, before reporting a communications failure. The default is 3, which should be adequate, and one should rarely need to change this, if ever. The primary purpose of this function is to enable setting the number of retries to zero, to force single-error events to cause detectable errors (as they would normally be fixed automatically via the retry mechanism) Returns: TRUE if successful, FALSE otherwise Notes: noneVSDRVR_API Int32 VsSetWavelength( VS_HANDLE vsHnd, double wl, BOOL confirm ) Arguments: vsHnd handle value returned by VsOpen() wl wavelength to tune to, in nm confirm logical flag, indicating whether to confirm actual wavelength value Purpose: this function sets the filter wavelength to the value in wl. If confirm is TRUE, it waits for the filter to complete the command, and then reads back the actual wavelength to confirm it was implemented successfully. Note that the only time there can be a disparity is when the wavelength requested by wl lies outside the legal range for that filter, or if the wavelength is specified to a finer resolution than the filter recognizes (normally, 0.01 nm). Returns: TRUE if successful, FALSE otherwise Notes: noneVSDRVR_API Int32 VsGetAllDrive( VS_HANDLE vsHnd, Int32 *pStages, Int32 drive[] ) Arguments: vsHnd handle value returned by VsOpen() pStages pointer to int that will receive the number of stages in the filter drive[] int array to receive the filter drive levels. Purpose: this function reports the number of filter stages in *pStages. If this argument is NULL, it is ignored. The function returns the actual drive level at each stage, in counts, in drive[] , which must not be NULL. Returns: TRUE if successful, FALSE otherwise Notes: The array drive[] must be large enough to receive all the drive levels ?if the exact number of stages is not known, call VsGetNstages() first, or allocate enough array elements (12) to accommodate the largest filter design.VSDRVR_API Int32 VsGetNstages( VS_HANDLE vsHnd, Int32 *pStages ) Arguments: vsHnd handle value returned by VsOpen() pStages pointer to int that will receive the number of stages in the filter Purpose: this function determines the number of optical stages in the filter and returns it in *pStages, which may not be NULL. Returns: TRUE if successful, FALSE otherwise Notes: noneVSDRVR_API Int32 VsGetPendingReply( VS_HANDLE vsHnd, LPSTR reply, Int32 nChars, Int32 *pQuit, Int32 firstMs, Int32 subsequentMs ) Arguments: vsHnd handle value returned by VsOpen() reply pointer to buffer that is to receive the reply nChars number of characters to receive pQuit pointer to flag to control this function ?see Notes below firstMs maximum time to wait, in ms, for first character of reply subsequentMs maximum time to wait, in ms, for each subsequent character Purpose: this function is used to exploit some of the less-common aspects of the filter, and it is likely that most programs will require its use. It receives a reply from the filter that may not arrive for a long time. The routine waits up to firstMs for the first character to arrive. Subsequent characters must arrive within subsequentMs of one another. Typically, this routine is called with a high value for firstMs and a lower value for subsequentMs. Returns: TRUE if successful, FALSE otherwise Notes: pQuit can be used to cancel this function while it is waiting for the reply, if that is desired, such as to respond to a user cancellation request. To use this feature, pQuit must be non-NULL and *pQuit must be FALSE at the time VsGetPendingReply() is called. VsGetPendingReply() checks this address periodically, and if it discovers that *pQuit is TRUE, it will cancel and return immediately.VSDRVR_API Int32 VsGetReply( VS_HANDLE vsHnd, LPSTR reply, Int32 nChars, Int32 waitMs ) Arguments: vsHnd handle value returned by VsOpen() reply pointer to buffer that will receive the filter reply nChars the number of characters sought waitMs the maximum time, in ms, to wait for the reply Purpose: this function is used to exploit those filter commands that are not directly provided by other functions, and most programmers will not need to use it. If the reply is not received in the time indicated by waitMs, or if less than nChars are received, the function returns with an unsuccessful status code. Returns: TRUE if successful, FALSE otherwise Notes: noneVSDRVR_API Int32 VsIsDiagnostic( VS_HANDLE vsHnd ) Arguments: vsHnd handle value returned by VsOpen() Function: determines whether the filter is in the diagnostic mode that is used at the factory for setup and calibration. This command is reserved for CRI use only. Returns: TRUE if diagnostic, FALSE otherwise. VSDRVR_API Int32 VsIsEngagedInBeam( VS_HANDLE vsHnd ) Arguments: vsHnd handle value returned by VsOpen() Function: determines whether the filter is engaged in the beam, when configured into certain CRI systems. This function is reserved for CRI use only Returns: TRUE if engaged in the beam, FALSE otherwise VSDRVR_API Int32 VsSendBinary( VS_HANDLE vsHnd, char *bin, Int32 nChars, BOOL clearEcho ) Arguments: vsHnd handle value returned by VsOpen() bin pointer a buffer that contains binary data to be sent to the filter nChars the number of binary characters to be sent clearEcho flag indicating whether to clear echo characters from the queue Purpose: this routine sends binary blocks of data to the filter. This is only necessary when programming calibration data to the filter, and it is not anticipated that this function will be necessary in any normal use. Returns: TRUE if successful, FALSE otherwise Notes: none VSDRVR_API Int32 VsSendCommand( VS_HANDLE vsHnd, LPCSTR cmd, BOOL sendEolChar) Arguments: vsHnd handle value returned by VsOpen() cmd pointer to the command to be sent to the filter sendEolChar flag indicating whether to append the end-of-line character or not Purpose: this function sends the command in cmd to the filter, and appends an end-of-line terminator (or not) based on sendEolChar. It automatically retrieves and discards the character echo of this command by the VariSpec. It does not automatically retrieve the reply, if any, from the VariSpec. Returns: TRUE if successful, FALSE otherwise Notes: The parameter sendEolChar should normally be true in all cases, unless one is sending individual character commands such as the ??or 慇?commands described in the VariSpec user抯 manual.VSDRVR_API Int32 VsSetStageDrive( VS_HANDLE vsHnd, Int32 stage, Int32 drive ) Arguments: vsHnd handle value returned by VsOpen() stage stage number whose drive level is to be adjusted drive drive level, in counts, for that stage Purpose: this function provides a way to manually adjust the drive levels at each of the filter抯 optical stages. It is normally used only during manufacture, and is not a function that most software programs will have any reason to use. Returns: TRUE if successful, FALSE otherwise Notes: none VSDRVR_API Int32 VsThermistorCounts( VS_HANDLE vsHnd, Int32 *pCounts ) Arguments: vsHnd handle value returned by VsOpen() pCounts pointer to int that will receive the thermistor signal, in counts Purpose: this function provides a way to determine the signal level, in counts, at the thermistor. It is normally used only during manufacture, and is not a function that most software programs will have any reason to use. Returns: TRUE if successful, FALSE otherwise Notes: none

13,822

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧