⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cenvi.doc

📁 C 语言开发HNT格式数据库系统
💻 DOC
📖 第 1 页 / 共 4 页
字号:
            *Install.cmm: Install this registered version of CEnvi.
            *KeyCode.cmm: Display keycodes returned by getch().
            *KeyGhost.cmm: Demonstrate how to use KeyPush.lib to control
              other applications.
            *KeyPush.lib: Library of routines created for passing
              keystrokes to a window with the current focus.
            *Message.lib: Wrapper for Windows' PostMessage() and
              SendMessage() function to send commands to windows.
            *MsgBox.lib: A wrapper library for Windows' MessageBox()
              function.  This file is #include'd in other CEnvi sample
              files.
            *MsgBoxes.cmm: Show various message box types using the
              function in MsgBox.lib.
            *NumLock.cmm: Set the NUMLOCK key ON
            *OpenCmm.cmm: Use Windows' common dialog (via PickFile.lib) to
              select a *.cmm file to edit.
            *PickFile.lib: A simple interface to the GetOpenFileName()
              function in the Windows Common Dialog DLL.  This library file
              is #include'd in some of the other CEnvi sample files.
            *PMCorner.cmm: Minimize Program Manager and then move its icon
              to the lower-right corner of the screen.
            *PongTime.cmm: Bounce the Windows clock mini-app around
            *Quote.cmm: Choose a "profound" quote at random
            *RunTime.cmm: Schedule a command to execute at a specified hour
              and minute.
            *Terminal.cmm: A simple terminal program; demonstrate some of
              the functions in COMM.lib
            *WhoRYou.cmm: Design and implement a dialog box using CEnvi's
              MakeWindow() and DoWindows() functions
            *WinBeep.cmm: Call Windows' MessageBeep() function.
            *Window.lib: A few functions and many defined values useful for
              CEnvi's MakeWindow(), BreakWindow(), and DoWindows()
              functions
            *WinExec.lib: A wrapper library for Windows' WinExec()
              function.  This file is #include'd in other CEnvi sample
              files.
            *WinExecs.cmm: Demonstration of Windows' WinExec() function
              using the wrapper from WinExec.lib.
            *WinList.cmm: Show a list of all Windows, their handles, and
              their children.
            *WinMsg.cmm: Demonstrate how to make a window, and show all the
              messages that go to that window
            *WinShell.bat: Start windows with a specific shell.  Run
              Windows for a single program.  This use CENVI.EXE for DOS.
            *WinTools.cmm: Demonstrate many of the capabilities of
              WinTools.lib
            *WinTools.lib: Library of routines for directly manipulating
              windows by name or by handle
            *WinUtil.lib: A small selection of utilities that may be
              #include'd in CEnvi code to get simple access to Windows DLL
              functions.

1.6.  CEnvi - A Cmm Interpreter

          This section describes the CEnvi program, and describes the
          various methods for use CEnvi.exe to execute Cmm programs.

1.6.1   What is CEnvi?

          CEnvi is the first (and so far only) application to implement the
          Cmm programming language.  CEnvi is a Command-line version of a
          Cmm interpreter, and it can use Environment variables as if they
          were global Cmm variables.  CEnvi contains a reasonable facsimile
          of the standard C library, and can link at runtime to external
          Cmm libraries.

          The "Envi" and the "C" in CEnvi reflects the envy that computer
          professionals often feel when they are working on a computer that
          does not have a complete C programming environment.  "Envi" also
          refers to the environment variables that CEnvi attempts to work
          with as if they were regular Cmm variables.

          Like all implementations for Cmm, CEnvi is portable between
          operating systems.  It is currently testing under DOS, OS/2, and
          Windows, and other OS ports are in the works.

1.6.2   Environment Variables

          Variables in all UPPERCASE letters are taken from the environment
          variables.  Environment variables are treated like other
          variables except that they don't need quotes around them to
          default to being strings if they don't match another type.

          To the source code, the only difference between a variable and an
          environment variable is that environment variables are all
          UPPER_CASE letters.  When the environment variable is first used
          it is read from the environment block and some assumptions are
          made about what kind of variable it is; this can lead to problems
          when I=666 is interpreted as the number 666 when really it maybe
          should have been the string "666".  Before the program exits, all
          environment variables used by the code are then written to the
          environment block.

          In some implementations (CEnvi for DOS, for example) the
          environment variables remain changed even after the Cmm
          interpreter exits.  In other cases, special kludges must be added
          to alter a parent process' environment variables (see ESet() for
          OS/2).

1.6.3   Special Environment Variables

          These environment variables affect where CEnvi looks for source
          files:
            *CMMPATH: This environment will be checked for directories to
              search for include files if the include file is not in the
              current directory.  For Windows, this value may come from the
              CMMPATH profile value in WIN.INI (in the [CEnvi] section).
            *PATH: Batch-file source files (see below) will be searched in
              these directories if not found in the current directory.
            *CENVI_ESET: In those environment for which CEnvi cannot
              covertly alter the environment variables of the command
              interpreter (e.g., OS/2), this environment variable specifies
              a file name.  CEnvi will write the strings necessary for the
              command interpreter to set environment variables as altered
              by your Cmm code.  See the description of ESet() for more
              information about this command.

1.6.4   Executing Code as command-line Input Parameters

          If a Cmm program is very short, then it can be executed wholly
          from the command line.  For example, here is the famous hello
          world program executed from the cli prompt:
              CEnvi main() { printf("Hello world!"); }
          which can be written more conisely under Cmm rules as:
              CEnvi printf("Hello world!")

          You may have to keep in mind bahavior of the cli when inputting
          code.  It is sometimes necessary to put quotes around code to
          keep symbols from being interpreted by the cli, as in this
          example:
              CEnvi "for(i=0;i<10;i++) printf("%d\n",i)"
          where the quotes are necessary to prevent the cli from
          interpreting the "<" as file redirection.

          Also, in batch files (DOS, OS/2) you need to remember that "%"
          has special meaning for the batch file processor, and so the
          above line in a batch would have to be written as:
              CEnvi "for(i=0;i<10;i++) printf("%%d\n",i)"

1.6.5   Executing *.CMM Source File Code

          A file with the extension ".CMM", if the file name is given as
          the first parameter to CEnvi.exe, is considered by CEnvi to be
          pure CMM source code.  This file with the .CMM extension is
          expected to be a plain Cmm source file, just as a C compiler
          expects a file with the .C extension to be C source code.  CEnvi
          will check the current directory for the .CMM file, and then
          check directories in the PATH environment variable.  Any
          arguments passed to CEnvi.exe after the .CMM source name are
          given to the main(argc,argv) function in the source, if there is
          one.  So the hellow.cmm program can look identical to the
          hellow.c program, and when you run CEnvi.exe hellow.cmm you get
          the same output.  If you run
              CEnvi.exe FOO.CMM One Two Three
          the main function in FOO.CMM would get argc=4 and
          argv[0]="FOO.CMM" and argv[3]="THREE".

          This all means that if you were to have an executable FOO.EXE
          that is similar to FOO.CMM, then "FOO.EXE" is interchangeable
          with "CENVI FOO.CMM", i.e.,
              FOO.EXE arg1 arg2 arg3
          is the same as:
              CENVI FOO.CMM arg1 arg2 arg3

          In OS/2 or windows or other environments where file extensions
          can be associated with programs, you may want to associate the
          .CMM extension with CEnvi.exe, so that double-clicking on
          HELLOW.CMM will act identically to double-clicking on the
          compiled-and-linked HELLOW.EXE.

1.6.6   Batch-File Kludge

          The most convenient method for executing Cmm source code from the
          DOS or OS/2 command line is sort of a kludge: if the first
          argument to CEnvi is the name of a batch file, then CEnvi reads
          that batch file and accepts as source all the code between the
          lines "GOTO CENVI_EXIT" and ":CENVI_EXIT", and passes the command
          line arguments to main(argc,argv).  This is very similar to
          executing:
              CEnvi.exe #include'foo,bat,,GOTO CENVI_EXIT,:CENVI_EXIT'
          except that the '#include' statement is handled automatically by
          CEnvi, and the rest of the command-line arguments are passed to
          main().

          Note that ".bat" is the DOS version of the batch file name
          extension.  This name is different for different operating
          systems.

          In this way, a batch file can be run exactly like a .EXE file,
          and the command arguments are passed to main in the same way.  If
          the full path of the batch file is not supplied, then CENvi will
          look in the current directory and then in directories in the
          PATH.

          Here is an example of an OS/2 batch file that expects any number
          (up to 9) of integers and sets the SUM environment variable to
          the values added together.  (It calls CEnviSet instead of CEnvi
          directly in order to set the environment variable.)

              @echo off
              REM *********************************************************
              REM *** SUM.BAT - Use CEnvi to sum lots of numbers together,*
              REM ***           setting the SUM environment variable to   *
              REM ***           the result of adding all the numbers.     *
              REM *********************************************************
              call CEnviSet %0.bat %1 %2 %3 %4 %5 %6 %7 %8 %9
              GOTO CENVI_EXIT

              main(argc,argv)
              {
                SUM = 0;
                for ( i = 1; i < argc; i++ )
                SUM += atoi(argv[i])
              }

              :CENVI_EXIT

1.6.7   EXTPROC: *.CMD Source file (For OS/2)

          Under the OS/2 command processor, you can define an external
          processor to process a batch (*.cmd) file if the first statement
          is EXTPROC.  EXTPROC is followed by the name of the processor,
          which in this case will be "CEnvi".  This is an example file,
          ARGS.CMD, of a program to display all input parameters:

              EXTPROC CEnvi

              main(argc,argv)
              {
                for ( i = 0; i < argc; i++ )
                printf("Input argument %d = \%s\n",i,argv[i]);
              }

1.6.8   REXX-File Kludge (For OS/2)

          Similar to the Batch-File Kludge described above, if the first
          argument to CEnvi is the name of a REXX source file then CEnvi
          automatically executes the code between "SIGNAL CENVI_EXIT" and

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -