EnglishРусский  

   ..

   gentee.c

   gentee.h

The project is closed! You can look at a new scripting language. It is available on GitHub.
Also, try our open source cross-platform automation software.

Ads

Installer and installation software
Commercial and Freeware installers.

  1 /******************************************************************************
  2 *
  3 * Copyright (C) 2006, The Gentee Group. All rights reserved. 
  4 * This file is part of the Gentee open source project - http://www.gentee.com. 
  5 * 
  6 * THIS FILE IS PROVIDED UNDER THE TERMS OF THE GENTEE LICENSE ("AGREEMENT"). 
  7 * ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE CONSTITUTES RECIPIENTS 
  8 * ACCEPTANCE OF THE AGREEMENT.
  9 *
 10 * Author: Alexey Krivonogov (gentee)
 11 *
 12 ******************************************************************************/
 13 
 14 #ifndef _GENTEE_
 15 #define _GENTEE_
 16 
 17    #ifdef __cplusplus               
 18       extern "C" {                 
 19    #endif // __cplusplus      
 20 
 21 //--------------------------------------------------------------------------
 22 
 23 #include "../common/str.h"
 24 #include "../vm/vm.h"
 25 #include "../compiler/compile.h"
 26 
 27 /*-----------------------------------------------------------------------------
 28 * Id: setpars D
 29 * 
 30 * Summary: States for gentee_set function.
 31 *
 32 -----------------------------------------------------------------------------*/
 33 
 34 #define GSET_TEMPDIR  0x0001  // Specify the custom temporary directory
 35 #define GSET_PRINT    0x0002  // Specify the custom print function
 36 #define GSET_MESSAGE  0x0003  // Specify the custom message function
 37 #define GSET_EXPORT   0x0004  // Specify the custom export function
 38 #define GSET_ARGS     0x0005  // Specify the command-line arguments
 39 #define GSET_FLAG     0x0006  // Specify flags 
 40 #define GSET_DEBUG    0x0007  // Specify the custom debug function
 41 #define GSET_GETCH    0x0008  // Specify the custom getch function
 42 
 43 /*-----------------------------------------------------------------------------
 44 * Id: ptrpars D
 45 * 
 46 * Summary: States for gentee_ptr function.
 47 *
 48 -----------------------------------------------------------------------------*/
 49 
 50 #define GPTR_GENTEE   0x0001  // Pointer to gentee structure. See $[tgentee].
 51 #define GPTR_VM       0x0002  // Pointer to vm structure
 52 #define GPTR_COMPILE  0x0003  // Pointer to compile structure
 53 #define GPTR_CALL     0x0004  // Pointer to gentee_call function
 54 
 55 /*-----------------------------------------------------------------------------
 56 * Id: geloadflag D
 57 * 
 58 * Summary: Flags for gentee_load function.
 59 *
 60 -----------------------------------------------------------------------------*/
 61 
 62 #define GLOAD_ARGS    0x0001  // Get command line arguments
 63 #define GLOAD_FILE    0x0002  // Read file to load the bytecode. The bytecode /
 64                               // is name of the loading file
 65 #define GLOAD_RUN     0x0004  // Load #lgt(entry) functions and run #lgt(main) /
 66                               // function.
 67 
 68 /*-----------------------------------------------------------------------------
 69 * Id: initflags D
 70 * 
 71 * Summary: Flags for gentee_init and gentee.flags structure.
 72 *
 73 -----------------------------------------------------------------------------*/
 74 
 75 #define G_CONSOLE  0x0001   // Console application.
 76 #define G_SILENT   0x0002   // Don't display any service messages.
 77 #define G_CHARPRN  0x0004   // Print Windows characters.
 78 #define G_ASM      0x0008   // Run-time converting a bytecode to assembler.
 79 #define G_TMPRAND  0x0010   // Random name of t temporary directory.
 80 
 81 /*-----------------------------------------------------------------------------
 82 * Id: getidflag D
 83 * 
 84 * Summary: Flags for gentee_getid
 85 *  
 86 -----------------------------------------------------------------------------*/
 87 
 88 #define GID_ANYOBJ  0x01000000   // Find any object
 89 
 90 /*-----------------------------------------------------------------------------
 91 *
 92 * ID: functype 25.10.06 0.0.A.
 93 * 
 94 * Summary: The function types
 95 *  
 96 -----------------------------------------------------------------------------*/
 97 
 98 typedef uint  (STDCALL* messagefunc)( pmsginfo );
 99 typedef void  (STDCALL* printfunc)( pubyte, uint );
100 typedef uint  (STDCALL* getchfunc)( pubyte, uint );
101 typedef void* (STDCALL* exportfunc)( pubyte );
102 typedef void  (STDCALL* debugfunc)( pstackpos );
103 
104 /*-----------------------------------------------------------------------------
105 ** Id: tgentee T gentee
106 * 
107 * Summary: The main structure of gentee engine.
108 *
109 -----------------------------------------------------------------------------*/
110 
111 typedef struct {
112    uint         flags;      // Flags. $$[initflags]
113    uint         multib;     // 1 if the current page is two-bytes code page
114    uint         tempid;     // The indetifier of the temporary directory.
115    str          tempdir;    // The temporary directory
116    uint         tempfile;   // The handle of the file for locking tempdir
117    printfunc    print;      // The custom print function
118    getchfunc    getch;      // The custom getch and scan function
119    messagefunc  message;    // The custom message function
120    exportfunc   export;     // The custom export function 
121    debugfunc    debug;      // The custom debug function
122    pubyte       args;       // Command -line arguments. arg1 0 arg2 00
123 } gentee, *pgentee;
124 
125 //--------------------------------------------------------------------------
126 
127 extern gentee    _gentee;
128 extern pcompile  _compile;    // The pointer to compile structure
129 
130 //--------------------------------------------------------------------------
131 #ifdef BUILD_DLLRT
132   #undef DLL_EXPORT
133   #define DLL_EXPORT __declspec(dllexport)
134 #endif
135 
136 uint  DLL_EXPORT STDCALL gentee_deinit( void );
137 uint  DLL_EXPORT STDCALL gentee_init( uint flags );
138 uint  DLL_EXPORT STDCALL gentee_set( uint state, pvoid val );
139 pvoid DLL_EXPORT STDCALL gentee_ptr( uint par );
140 uint  DLL_EXPORT STDCALL gentee_load( pubyte bytecode, uint flag );
141 uint  DLL_EXPORT CDECLCALL gentee_call( uint id, puint result, ... );
142 uint  DLL_EXPORT CDECLCALL gentee_getid( pubyte name, uint count, ... );
143 
144 //--------------------------------------------------------------------------
145 
146    #ifdef __cplusplus              
147       }                            
148    #endif // __cplusplus
149 
150 #endif // _GENTEE_