EnglishРусский  

   ..

   cmdlist.c

   cmdlist.g

   cmdlist.h

   funclist.g

   ge.h

   geasm.c

   geload.c

   gesave.c

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.

source\src\bytecode\funclist.g
  1 #!gentee.exe "%1"
  2 /******************************************************************************
  3 *
  4 * Copyright (C) 2006, The Gentee Group. All rights reserved. 
  5 * This file is part of the Gentee open source project - http://www.gentee.com. 
  6 * 
  7 * THIS FILE IS PROVIDED UNDER THE TERMS OF THE GENTEE LICENSE ("AGREEMENT"). 
  8 * ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE CONSTITUTES RECIPIENTS 
  9 * ACCEPTANCE OF THE AGREEMENT.
 10 *
 11 * Author: Alexey Krivonogov ( gentee )
 12 *
 13 * Contributors: Sergey ( SWR )
 14 *
 15 * Summary: The program genertaes funclist.h and funclist.с files 
 16 *
 17 ******************************************************************************/
 18 
 19 //include : $"..\..\lib\gtold\gt.g"
 20 include : $"..\..\lib\stdlib\stdlib.g"
 21 include : $"..\..\lib\gt\gt.g"
 22 
 23 /*-----------------------------------------------------------------------------
 24 *
 25 * ID: headerout 12.10.06 1.1.A.
 26 * 
 27 * Summary: 
 28 *  
 29 -----------------------------------------------------------------------------*/
 30 
 31 text headerout( str name author summary )
 32 /******************************************************************************
 33 *
 34 * Copyright (C) 2006, The Gentee Group. All rights reserved. 
 35 * This file is part of the Gentee open source project <http://www.gentee.com>. 
 36 * 
 37 * THIS FILE IS PROVIDED UNDER THE TERMS OF THE GENTEE LICENSE ("AGREEMENT"). 
 38 * ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE CONSTITUTES RECIPIENTS 
 39 * ACCEPTANCE OF THE AGREEMENT.
 40 *
 41 * \(name) \{
 42    str      sdate
 43    datetime dt
 44    getdatetime( dt.gettime(), sdate, 0->str )
 45 //   @"\(name) "
 46    @sdate 
 47 } 0.0.A.
 48 *
 49 * Author: \(author)
 50 *
 51 * Summary: \(summary)
 52 *
 53 ******************************************************************************/
 54 \!
 55 
 56 /*-----------------------------------------------------------------------------
 57 *
 58 * ID: funclist_h 12.10.06 1.1.A. 
 59 * 
 60 * Summary: The .h output function.
 61 *  
 62 -----------------------------------------------------------------------------*/
 63 text funclist_h( arrstr acmd, arrstr cmt )
 64 \@headerout( "funclist_h", "Generated with 'funclist' program", 
 65 "This file contains a list of the embedded functions and methods.")
 66 #ifndef _FUNCLIST_
 67 #define _FUNCLIST_
 68 
 69    #ifdef __cplusplus
 70       extern "C" {
 71    #endif // __cplusplus
 72 
 73 #include "../common/types.h"
 74 
 75 #define  FUNCCOUNT  \( *acmd )
 76 
 77 extern const ubyte embfuncs[];
 78 extern const pvoid embfuncaddr[];
 79 
 80 /*
 81 \{ 
 82    uint k
 83    fornum k, *cmt
 84    {
 85        @"\( cmt[k] )\n"
 86    }
 87 }
 88 */
 89    #ifdef __cplusplus
 90       }
 91    #endif // __cplusplus
 92 
 93 #endif // _FUNCLIST_
 94 \!
 95 
 96 /*-----------------------------------------------------------------------------
 97 *
 98 * ID: cmdlist_h 12.10.06 1.1.A. 
 99 * 
100 * Summary: The .c output function.
101 *  
102 -----------------------------------------------------------------------------*/
103 
104 text  funclist_c( arrstr aout, arrstr ptr )
105 \@headerout( "funclist_c", "Generated with 'funclist' program",
106 "This file contains the embedded functions.")
107 
108 #include <math.h>
109 #include "../genteeapi/gentee.h"
110 #include "funclist.h"
111 #include "bytecode.h"
112 #include "cmdlist.h"
113 #include "../common/crc.h"
114 #include "../common/mix.h"
115 #include "../common/arr.h"
116 #include "../common/collection.h"
117 #include "../vm/vmtype.h"
118 #include "../vm/vmres.h"
119 #include "../algorithm/qsort.h"
120 #include "../algorithm/search.h"
121 
122 #ifdef RUNTIME
123 extern uint  STDCALL gentee_lex( pbuf input, plex pl, parr output );
124 extern plex  STDCALL lex_init( plex pl, puint ptbl );
125 extern void  STDCALL lex_delete( plex pl );
126 //uint  STDCALL gentee_lex( pbuf input, plex pl, parr output ){ return 0; }
127 //plex  STDCALL lex_init( plex pl, puint ptbl ){ return NULL; }
128 //void  STDCALL lex_delete( plex pl ){}
129 uint  STDCALL gentee_compile( pcompileinfo compinit ){ return 0; }
130 #endif
131 
132 #if defined __WATCOMC__
133    #define  ATOI64 atoll
134 #else
135    #define  ATOI64 _atoi64
136 #endif
137 
138 const ubyte embfuncs[] = {
139 \{
140    uint i
141    
142    fornum i, *aout
143    {
144       if aout[i][0] >= '0' && aout[i][0] <= '9'
145       {
146          @"0x\( hex2stru(uint( aout[i] ))), "
147       }
148       elif aout[i][0] == 'T' : @"\(aout[i]), "
149       else
150       {
151          uint k
152          str  stemp
153         
154          if(i !=0):stemp += "\l"
155          fornum k, *aout[i]
156          {
157             stemp += "'"
158             stemp.appendch( aout[i][k] )
159             stemp += "', "
160          }
161          stemp += "0, "
162          @stemp
163       } 
164    }
165 }
166 };
167 
168 const pvoid embfuncaddr[] = {
169 \{
170    uint prev = *this  
171    
172    fornum i = 0, *ptr
173    {
174       @"\(ptr[i]), "
175       if *this > prev + 65
176       {
177          @"\l"
178          prev = *this
179       }   
180    }
181 }
182 };
183 \!
184 
185 /*-----------------------------------------------------------------------------
186 *
187 * ID: funcmain 12.10.06 1.1.A.ABKL 
188 * 
189 * Summary: The main function.
190 *  
191 -----------------------------------------------------------------------------*/
192 
193 func main<main>
194 {
195    arrstr aout
196    arrstr ptr
197    arrstr cmt
198    str hout
199    gt cmdgt
200 //   gtitems gtis
201    
202    cmdgt.read( "funclist.gt" )
203    foreach cur, cmdgt.root()//.items( gtis )
204    {
205       str     stemp 
206       str     ret
207       arrstr  items 
208       
209       cur as gtitem
210       if cur.comment : continue 
211 //      aout += cur.name
212       cur.get("comment", stemp )
213       cmt += stemp
214 
215       cur.get("name", stemp )
216       aout += stemp
217 
218       cur.get("ret", ret )
219       cur.get("params", stemp )
220       stemp.split( items, ',', $SPLIT_NOSYS )
221       
222       aout += str( *items | ?( *ret, 0x80, 0 ))
223       if *ret : aout += ret
224       foreach curit, items
225       {
226          aout += curit
227       }
228       cur.get("func", stemp )
229       ptr += stemp
230 //         shift += "SH_TYPE"
231    }
232    hout@funclist_h( ptr, cmt )
233    hout.write( "funclist.h" )
234    hout.clear()
235    hout@funclist_c( aout, ptr )
236    hout.write( "funclist.c" )
237    congetch("Press any key...")
238 }
239