EnglishРусский  

   ..

   compiler.g

Ads

Perfect Automation tool
All-In-One: Script editor, Launcher, Scheduler, Keyboard & Mouse Recorder. Try now!

CreateInstall
Freeware and commercial installers.

Cell Phone Batteries
Batteries Plus offers batteries for laptop, camcorder, cell phone, camera.

Gentee needs your help!
How to advertise with us
 
laptop battery

source\lib\compiler\compiler.g
  1 /******************************************************************************
  2 *
  3 * Copyright (C) 2004-2008, 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 define
 15 {
 16    GSET_TEMPDIR  = 0x0001  // Specify the custom temporary directory
 17    GSET_PRINT    = 0x0002  // Specify the custom print function
 18    GSET_MESSAGE  = 0x0003  // Specify the custom message function
 19    GSET_EXPORT   = 0x0004  // Specify the custom export function
 20    GSET_ARGS     = 0x0005  // Specify the command-line arguments
 21    GSET_FLAG     = 0x0006  // Specify flags 
 22    GSET_DEBUG    = 0x0007  // Specify the custom debug function
 23    GSET_GETCH    = 0x0008  // Specify the custom getch function
 24 
 25    CMPL_SRC    = 0x0001   // If compileinfo.input is Gentee source
 26    CMPL_NORUN  = 0x0002   // Don't run after compiling
 27    CMPL_GE     = 0x0004   // Create GE file
 28    CMPL_DEFARG = 0x0008   // Define arguments
 29    CMPL_LINE   = 0x0010   // Proceed #! at the first string
 30    CMPL_DEBUG  = 0x0020   // Compilation with the debug information
 31    CMPL_THREAD = 0x0040   // Compilation in the thread
 32    CMPL_NOWAIT = 0x0080   // Do not wait for the end of the compilation. /
 33                              // Use with CMPL_THREAD only.
 34    CMPL_OPTIMIZE = 0x0100 // Optimize the output GE file
 35 
 36    OPTI_DEFINE   = 0x0001   // Delete 'define' objects.
 37    OPTI_NAME     = 0x0002   // Delete names of objects.
 38    OPTI_AVOID    = 0x0004   // Delete no used objects.
 39    OPTI_MAIN     = 0x0008   // Leave only one main function with OPTI_AVOID.
 40 
 41    G_CONSOLE = 0x0001   // Console application.
 42    G_SILENT  = 0x0002   // Don't display any service messages.
 43    G_CHARPRN = 0x0004   // Print Windows characters.
 44 
 45 }
 46 
 47 type optimize
 48 {
 49    uint     flag     // Flags of the optimization. $$[optiflags]
 50    uint     nameson  // Don't delete names with the following wildcards /
 51                      // divided by 0 if OPTI_NAME specified
 52    uint     avoidon  // Don't delete objects with the following wildcards /
 53                      // divided by 0 if OPTI_AVOID specified
 54 }
 55 
 56 type compileinfo
 57 {
 58    uint    input      // Gentee source or filename 
 59    uint    flag       // Compile flags
 60    uint    includes   // folders for searching files  name 0 name 00
 61    uint    libs       // include files  name 0 name 00
 62    uint    defargs    // define arguments  name 0 name 00
 63    uint    output     // Ouput filename for GE
 64    uint    hthread    // The result handle of the thread if you specified    /
 65                       // CMPL_THREAD | CMPL_NOWAIT. 
 66    uint    result     // Result of the program if it was executed.
 67    optimize opti      // Optimize structure. It is used if flag CMPL_OPTIMIZE /
 68                       // is defined.
 69 }
 70 
 71 type gcompileinfo
 72 {
 73    str     input      // Gentee source or filename 
 74    uint    flag       // Compile flags
 75    arrstr  includes   // folders for searching files  name 0 name 00
 76    arrstr  libs       // include files  name 0 name 00
 77    arrstr  defargs    // define arguments  name 0 name 00
 78    arrstr  args       // Command line arguments
 79    str     output     // Ouput filename for GE or EXE
 80    uint    hthread    // The result handle of the thread if you specified    /
 81                       // CMPL_THREAD | CMPL_NOWAIT. 
 82    uint    result     // Result of the program if it was executed.
 83    uint    optiflag   // Flags of the optimization. $$[optiflags]
 84    arrstr  nameson    // Don't delete names with the following wildcards /
 85                       // if OPTI_NAME specified
 86    arrstr  avoidon    // Don't delete objects with the following wildcards /
 87                       // divided by 0 if OPTI_AVOID specified
 88 }
 89 
 90 func uint compile_arrs( arrstr input, buf output )
 91 {
 92    uint i
 93    
 94    output.clear()
 95    if *input
 96    {
 97       fornum i, *input
 98       { 
 99          output.append( input[ i ].ptr(), *input[ i ] + 1 )
100       }
101    }
102    output += ubyte( 0 )
103    return 1
104 }
105 
106 func  compile_file( gcompileinfo gcinfo )
107 {
108    compileinfo  cmpl
109    buf          includes libs defargs nameson args avoidon
110    
111    cmpl.input = gcinfo.input.ptr()
112    cmpl.flag = gcinfo.flag//$CMPL_NORUN | $CMPL_GE
113    
114    compile_arrs( gcinfo.includes, includes ) 
115    cmpl.includes = includes.ptr()
116    
117    compile_arrs( gcinfo.libs, libs ) 
118    cmpl.libs = libs.ptr()
119    
120    compile_arrs( gcinfo.defargs, defargs ) 
121    cmpl.defargs = defargs.ptr()
122 
123    compile_arrs( gcinfo.args, args ) 
124    gentee_set( $GSET_ARGS, args.ptr())
125    
126    cmpl.output = gcinfo.output.ptr()
127    
128    cmpl.opti.flag = gcinfo.optiflag
129    compile_arrs( gcinfo.nameson, nameson ) 
130    cmpl.opti.nameson = nameson.ptr()
131 
132    compile_arrs( gcinfo.avoidon, avoidon ) 
133    cmpl.opti.avoidon = avoidon.ptr()
134    
135    gentee_compile( &cmpl )      
136 }
137 
Edit