  Here I'll put some common and not so common questions about the editor
running under DOS and Windows. These comments apply to the DOS version
running on DOS and/or Windows and not the native Win32 version.

1. Video questions.
1.1 Screen goes black (or green or any strange option) when I exit the
editor or call a shell.
1.2 Running in a Win9x window rather than full screen.

2. Incompatibilities with other programs and TSRs
2.1 Problems with antivirus TSRs.

3. Miscellaneous
3.1 Do you really think your screen saver can be called screen saver?
3.2 Why I can't access files in a directory called c:\dev?
3.3 I'm using Windows NT (4.0, 2k, XP, etc.) and defined Set_Files but it
doesn't work, why?
3.4 I'm using Windows NT (4.0, 2k, XP, etc.) and I can copy/paste to/from the
Windows clipboard, why?

4. Mouse problems
4.1 I don't get a mouse pointer while I'm in DOS, why?
4.2 I can see both mouse pointers (graphical and text) when the editor is
running windowed under W9x, why?
4.3 The mouse works, but I can't see the mouse pointer!
4.4 I'm using Windows 2000 or XP and I have problems with the mouse.

5. Sound problems
5.1 The sound is too noisy (crispy), why?

6. Keyboard problems
6.1 The editor doesn't catch all the keyboard combinations, why?
6.2 I get random keys pressed all the time, why?

7. sLisp macro language
7.1 How can I extend it?

8. Edition modes
8.1 What options should I use to get real tabs (ascii 9)?

=============================================================================
1. Video questions.

1.1 Q: My screen goes black (or green or any strange option) when I exit the
editor or call a shell, what's up?

A: I found that some video boards have a bug in the implementation of the VGA
save/restore state (service 0x1C interrupt 0x10). Some Matrox boards have
this problem.
  You can try starting the editor with the --low-vga-save command line
option. In this case the editor uses a low level routine (just in and outs)
to do the job, it should work for any board that is 100% compatible with the
IBM's VGA standard.
  I found this solution thanks to the help of Anders Blom
<blom@teorfys.lu.se>, he tested some programs I sent him until we found where
the problem was. Also Nate Eldredge <nate@cartsys.com> tested some stuff in
your Matrox video board using a brand new model and video drivers and all
works ok, so perhaps you can just upgrade your BIOS/video drivers if you have
one of these problematic boards.
  Additionally Maurice Lombardi <Maurice.Lombardi@ujf-grenoble.fr> reported
the problems with your Matrox Millenium II went away after upgrading
BIOS/video drivers.

-----------------------------------------------------------------------------
1.2 Q: Is a good idea run the editor in a Win9x window? Should I use full
screen?
Q: If I use a graphic screen saver and it starts when the editor is windowed
my Win95 hangs, what's wrong in your program?

[Note: also see 1.1, could be the solution]
A: In Win9x the windowed DOS tasks are emulated with the help of the video
driver. Not all the video drivers works well, that's because:
a) The drivers from Microsoft are poorly tested, they only test in your test
bed machines.
b) The drivers from the manufacturer have bugs because Microsoft development
kits are cryptic.
  So "your mileage may vary".
  With my video board (Trident TGUI9440AGi) all works OK, but I know that
people using old drivers for this board had problems.
  Also I know that Diamond boards equiped with some S3 chips doesn't support
the screen saver of the editor. In this boards if a windowed application
calls BIOS to set the video mode 0x13 (320x200x256) Windows simply hangs. I
saw it in one machine at work that uses a "Diamond Stealth 64" board with S3
chipset.
  Endlisnis <s257m@unb.ca> reported problems with the following setup:

Name: ATI 3D Expression+
Chip Type:  Mach64: Rage II
Software Version:  5.21-C9N-WEB
Hardware Version: 065
No VESA TSR loaded.

  Using this board and changing the characters height to 12 (to get around 34
lines) the DOS box crashes generating a GPF after the editor exits. The same
happens if you are in full screen, exit the editor, wait some seconds and
then press ALT+ENTER.

  James Bunting <james@aic.co.uk> reported:

"When I run programs through RHIDE my user screen background goes green and
all of the character attributes get messed up.  I know that this problem is
been caused by my video card because I have tested it with another."

Name: 8MB Matrox Productiva AGP

  Similar reports were done by Matrox Millenium II users.

  M. Heumann <manfred.heumann@uni-bielefeld.de> had problems running the
applications windowed, but not in full screen. Card: Diamond Stealth 3D 2000
Turbo.
  Anders Blom <blom@lufysik.fysik.lu.se> kindly tested some small programs I
wrote in one of these Matrox boards and the video drivers fails to restore
the video when calling int 0x10 service AX=0x1c02. See question 1.1 for a
solution.
  Alexei A. Frounze <alex.fru@mtu-net.ru> reported that:

Win95 OSR2 Rus (4.0  Build 1212 B) DirectX (4.06.00.0318)
Cirrus Logic 5436 PCI gfx card (CL-GD5436 Rev 0, 4.10.00.1555 "4.10.00.1555"
English Final Retail).

  Shows problems if you change from full screen to windowed and then exit. He
solved your problems using a PIF that runs RHIDE (same case as editor) full
screen and disables the keys to make it windowed.
  Hans Yperman <hyperman@eduserv1.rug.ac.be> reports similar problems using
the Cirrus CL-GD5446.

  The GeForce BIOSes seems to have problems very similar to the ones Anders
found in Matrox cards. Andy <Bitland@aol.com> found a workaround and is
looking for testers. He have a GeForce based card:

Guillemot/Hercules 3D Prophet II MX
BIOS-version 3.11.00.08 (coming with b3dpmx-do-08.exe 19/Oct/2000)
NVIDIA Win-drivers 4.12.01.0635 (Guillemot-Version from 13/Oct/2000)

  The workaround is based in the code that 1.1 question describes. Please
read 1.1.

  Why it happends with setedit and RHIDE but not with other software? I'm not
sure about the answer but I'm almost sure is something related to the fact
that we use the save/restore VGA state services not commonly used by other
applications. In the future I'll make it optional, but by now we need it to
debug applications that works at register level with the VGA card.
=============================================================================
2. Incompatibilities with other programs and TSRs

2.1 Q: The editor and/or RHIDE makes conflict with my system, and even crash
my computer.

A: We found that some antivirus like old versions of NAV (Norton AntiVirus)
and the VShield v3.2.0 doesn't really support our programs. We don't know why
but these active antivirus are hooking some interrupt used by our programs
that makes troubles when called from a protected mode application. I think
they assume something that is clearly wrong when a DPMI application is
working.

"R.H." <rogerh40@aa.net> says: I am using McAfee Vshield 3.2.0 with scan
engine 3.2.2. If I compile and run a simple hello program and then exit
rhide, my system crashes. I know that it is caused by my Mcafee virus scanner
as if I boot into my fat32 Win98 without the virus scanner, everything works
fine.

=============================================================================
3. Miscellaneous

3.1 Q: Do you really think your screen saver can be called screen saver?

A: No. Look in "Tool&Ops|Options|Editor General", I put a question mark after
the "Screen saver" label. Some of these screen savers aren't really screen
savers, the best screen saver is a blanker (it just clears the screen), but
I like the plasma a pseudo smoke ;-).
  Also: Color monitors doesn't need real screen savers, monochrome does.
  Plus: I added a blanker to the list.

-----------------------------------------------------------------------------
3.2 Q: Why I can't access files in a directory called c:\dev?

A: Even when SETEdit is a DOS application uses the djgpp library which
emulates a lot of UNIX details. In UNIX the /dev directory contains devices
mapped to files, djgpp emulates it, so files in c:\dev, d:\dev, etc. have
special meaning. Avoid using files en these directories.

-----------------------------------------------------------------------------
3.3 I'm using Windows NT (4.0, 2k, XP, etc.) and defined Set_Files but it
doesn't work, why?

A: NT is case sensitive for environment variable you *must* use SET_FILES
(all capitals).
  
-----------------------------------------------------------------------------
3.4 I'm using Windows NT (4.0, 2k, XP, etc.) and I can copy/paste to/from the
Windows clipboard, why?

A: NT doesn't implement the WinOldAP API that allows DOS programs to access
some Windows stuff like the clipboard. Blame Microsoft for that.
=============================================================================
4. Mouse problems

4.1 Q: I don't get a mouse pointer while I'm in full screen, why?

A: Be sure the mouse driver is loaded. That isn't needed when the Windows 9x
GUI is loaded but is needed for pure DOS or Windows 3.1. If the mouse driver
is loaded keep reading.
   The Turbo Vision library currently needs a relative modern mouse driver. I
know some old drivers doesn't provide all the mouse functions needed.
   I know that the 7.83 version from Ultima Electronics dated in 1994 doesn't
work, the Agile Mouse version 7.03 dated in 1992 works and modern Genius
mouse drivers also works OK.

-----------------------------------------------------------------------------
4.2 Q: I can see both mouse pointers (graphical and text) when the editor is
running windowed under W9x, why?

A: If you are running with a non-standard (like 90x30) that's impossible to
avoid. When running in this mode the mouse pointer must be controlled by the
application because the mouse driver doesn't know how to do it. For this
reason the editor draws the pointer. Lamentably there is no way to know if
the program is windowed or not.

-----------------------------------------------------------------------------
4.3 Q: The mouse works, but I can't see the mouse pointer!

A: Try with the --no-mouse-hook command line options.

-----------------------------------------------------------------------------
4.4 Q: I'm using Windows 2000 or XP and I have problems with the mouse.

A: I personally don't have access to a W2k nor XP box and I don't really plan
to do it any time soon. The following explanation was posted to RHIDE's
mailing list and verified by two users:

"Clicking on the logo on the top left of the DOS box.
Going to properties.
Unchecking Quick Edit mode and Insert mode.

The mouse will work correctly the next time you open RHIDE and the problem
will not reoccur."

=============================================================================
5. Sound problems

5.1 The sound is too noisy (crispy), why?

A: Most PCI cards have problems to emulate the Sound Blaster when a djgpp
program is running.
   I saw it using a Creative 128 PCI card and Andreas Martin
<Bastardizer@t-online.de> reported similar problems with Creative Ensoniq
AudioPCI (Soundblaster) card. This topic was also discussed in the Allegro
mailing list.

=============================================================================
6. Keyboard problems

6.1 The editor doesn't catch all the keyboard combinations, why?

A: Some cases are obvious, like it: Windows 95 catches some keys and never
pass them to the application it can be solved fine tunning the direct access
or .pif file used.
  Others are more obscure. Ctrl+ ` 1 4 5 7 8 9 0 = ; ' , . and / and the
Macro key are never detected by BIOS. To detect this keys you can use a small
resident (TSR) program included in the kextend.zip file of this distribution.
  And other cases could be because you are using BIOS keyboard mode (to
detect if a key was pressed and extract it). If you use the -b option you'll
lose some keyboard combinations.

-----------------------------------------------------------------------------
6.2 I get random keys pressed all the time, why?

A: We use special routines to extract keys directly from the BIOS queue, but
some new motherboards seems to have a strange BIOS that handles the queue in
a different way breaking this methode. You can try using the -b option to
force the editor to use BIOS to extract keys. You'll lose some keyboard
combinations.
  We need volunteers that have this problem to help as find the problem, so,
if you experiment it please send me an e-mail.

=============================================================================
7. sLisp macro language

7.1 How can I extend it?

A: You must have C++ skills. The important source files are located in the
sdg directory and are prefixed with "mli". The header files are located in
sdg/include. Here is a small text I wrote for a user (Thiago) that
contributed an sLisp command. It helped Thiago so it could help you too:

<---------------------
> I've been reading the code of the sLisp interpreter, because I am
> trying to implement 'cond'. But I am having a hard time trying to
> understand it. Can you help me?

Of course but be patient I don't have long amounts of time.

> Can you give an overview of how is works?
> How is the sLisp code stored in memory after it is read?

There is a variable type for code, is basically some kind of string
variable that holds a function.

> I noticed that there is a "main" function in mli.cc. Is it possible
> to make a stand-alone version of the interpreter? How?

I think it was created for the first tests and trying to compile it
now could be a challenge.

> What is the difference between TLispCode and TLispCommand?

When you define a macro you are creating some kind of function. This
is stored in a code variable.
A code variable is like a string that contains a sLisp function.
When the parser tries to reduce a one statement like it (command ....)
uses a Command variable. That's just like an integer that indicates
which command must be applied to the arguments list.

I think the most important thing you must know to achieve your
objetive is how to extend the language.
sLisp have a group of core functions, they are defined in mli.cc look
for TMLIBase::cNames[MLIBaseCommands] and Command
TMLIBase::cComms[MLIBaseCommands]. The MLIBaseCommands value is
defined in mlibase.h, to add a new command or operator you must first
increment the counter and then add the name and function that
implements it to the arrays (char *TMLIBase::sNames[MLIBaseSymbols]
and Command TMLIBase::sComms[MLIBaseSymbols] for operators).
The core functionallity is extended by derived classes. One
specializes sLisp for SDG and the other for the editor. Commands that
only works for an edition buffer are defined in mliedito.cc (see char
*TMLIEditor::cNames[MLIEditorCommands]) The number of defined commands
is in mliedito.h.
To reduce the ammount of typing sLisp commands implementations relies
on some cleaver macros.
One important detail is that Lisp language is evaluated just like a
stack, things are ever nested. For this reason you'll see every
function will release your arguments from this stack at exit.
[Note: It applies to local copies of the arguments, the real arguments
are automatically released].
Let me show you a simple function:

DecFun(MLIBaseLeft)
{
 int l;
 LocVarStr(string);
 LocVarInt(left);
 
 CheckNumParams(cant!=2);
 GetString(0,string);
 GetInteger(1,left);
 
 l=left->val;
 if (l>string->len)
    l=string->len;
 
 MLIRetStrLen(string->str,l);
 
 CleanUp:
 destroyFloatVar(string);
 destroyFloatVar(left);
}

DecFun macro declares the C arguments list for this function, all
sLisp commands have the same so this macro abstracts it.
LocVarStr(string); declares a sLisp variable of type String called
string. That's just a pointer to object declaration.
In a similar way LocVarInt(left); declares an integer variable called
left.
Those are just pointers and doesn't have any value, in fact they are
null pointers.
To check we got the right number of arguments we use:
CheckNumParams(cant!=2); here if the number of arguments is !=2 a
parser error is generated. Some arguments could be optional and is
possible to implement functiona that takes a arbitrary number of
arguments. The cant variable says how many arguments we got.
To retrieve the arguments we use: GetString(0,string) and
GetInteger(1,left) the first takes a string that is the first argument
in the list (index 0) and the second takes an integer. They assign
their value to the variables we defined at the beginning of the
function. If the argument tipe doesn't match the code generates a
syntax error (or something like that). You can retreive just a
variable without speciying the type and act according the type.
The next 3 lines implements the function core.
To return a new string we use MLIRetStrLen(string->str,l).
And finally comes a clean up. This is a label because the above
mentioned macros jumps here in case of error.
Here you must release any variable used.
Take a look at mlibase.h to know about the available macros.
As you can see the code is simple and clean thanks to the macros.

Here is an interesting example: eval

DecFun(MLIBaseEval)
{
 int i;
 LocVar(Variable);
 
 for (i=0; i<cant; i++)
    {
     GetVar(i,Variable);
     if (i+1==cant)
        MLIRetObj(Variable);
     else
        destroyFloatVar(Variable);
    }
 CleanUp:
 return;
}

Looks quite simple and could be even confusing. The first interesting
thing here is that we use LocVar and GetVar, they takes just a
variable. It doesn't matter what type. When you take a variable it
could be just a variable (string, integer, etc.) or it could be a Code
variable. The GetVar applied to a Code variable evaluates it to reduce
the Code into a simple variable. So here just getting each variable is
enough to evaluate all the statements. The number of arguments is
arbitrary and we just use a for. The code returns the last object we
evaluated, not a copy, and that's why we destroy all but the last.
And here is the if example. I don't remmember why but it is
implemented without all the macros:

void MLIBaseIf(TMLIBase *o,int start ,int cant)
{
 if (cant<2 || cant>3)
   {
    o->Error=MLINumParam;
    MLIRetNULL();
    return;
   }
 TLispVar *p=o->Solve(start);
 int boolval=o->MLIBooleanValOf(p);
 destroyFloatVar(p);
 if (boolval)
    MLIRetObj(o->Solve(start+1));
 else
   if (cant==3)
      MLIRetObj(o->Solve(start+2));
   else
      MLIRetInt(0);
}

Here you can see what's inside the usual macros like GetxxxVar, the
->Solve is needed to evaluate an argument.
<---------------------

If you need more information just e-mail me.

=============================================================================
8. Edition modes

8.1 What options should I use to get real tabs (ascii 9)?

A: Most users that indents code using tabs uses the following options (Alt+G
or Alt+L):

Autoindent: ON
Use Tabs: ON
Intelligent C indent: OFF
Optimal Fill: ON
Don't move inside tabs: ON
Tab smart indents: OFF
Use indent size: OFF
Backspace unindents: OFF

=============================================================================
End of file

