EnglishРусский  

   ..

   arr.g

   arrstr.g

   arrustr.g

   buf.g

   console.g

   fcopy.g

   ffind.g

   file.g

   hash.g

   math.g

   process.g

   search.g

   stack.g

   stdlib.g

   str.g

   stradv.g

   strfile.g

   system.g

   ustr.g

Данный проект закрыт! Создан новый скриптовый язык с тем же именем. Всё доступно на GitHub.
Также попробуйте нашу open source кроссплатформенную программу для создания и управления скриптами.

Реклама

Инсталлятор CreateInstall
Бесплатные и коммерческие инсталляторы

  1 /******************************************************************************
  2 *
  3 * Copyright (C) 2004-2007, 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 /*-----------------------------------------------------------------------------
 15 * Id: array L "Array"
 16 * 
 17 * Summary: Array. You can use variables of the #b(arr) type for working with
 18            arrays. The #b(arr) type is inherited from the #b(buf) type. 
 19 *
 20 * List: *Operators,arr_oplen,arr_opfor,arr_opof,arr_opind,
 21          *Methods,arr_clear,arr_cut,arr_del,arr_expand,arr_insert,
 22          arr_move,arr_sort  
 23 * 
 24 -----------------------------------------------------------------------------*/
 25 
 26 /*-----------------------------------------------------------------------------
 27 * Id: arr_clear F3
 28 *
 29 * Summary: Clear an array. The method removes all items from the array.
 30 *  
 31 * Return: #lng/retobj#
 32 *
 33 -----------------------------------------------------------------------------*/
 34 
 35 method arr arr.clear()
 36 {
 37    this.del( 0, *this )
 38    this.free()   
 39    return this
 40 }
 41 
 42 /*-----------------------------------------------------------------------------
 43 * Id: arr_sort F2
 44 *
 45 * Summary: Sorting an array. Sort array items according to the sorting 
 46            function. The function must have two parameters containing pointers
 47            to two compared items. It must return #b(int) less than, equal to or
 48            greater than zero if the left value is less than, equal to or 
 49            greater than the first one respectively. 
 50 *  
 51 * Params: sortfunc - Sorting function. 
 52 * 
 53 * Return: #lng/retobj#
 54 *
 55 -----------------------------------------------------------------------------*/
 56 
 57 method arr arr.sort( uint sortfunc )
 58 { 
 59    sort( this.ptr(), *this, this.isize, sortfunc )//&setidvm( iv, sortfunc ))
 60    return this
 61 } 
 62 
 63 /*-----------------------------------------------------------------------------
 64 * Id: arr_opfor F5
 65 *
 66 * Summary: Foreach operator. You can use #b(foreach) operator to look over 
 67            items of the array. 
 68 *  
 69 * Title: foreach var,arr
 70 *
 71 * Define: foreach variable,array {...}
 72 * 
 73 -----------------------------------------------------------------------------*/
 74 
 75 method uint arr.eof( fordata fd )
 76 {
 77    return ?( fd.icur < *this, 0,  1 )   
 78 }
 79 
 80 method uint arr.first( fordata fd )
 81 {  
 82    return this.index( fd.icur = 0 )
 83 }
 84 
 85 method uint arr.next( fordata fd )
 86 {
 87    return this.index( ++fd.icur )
 88 }
 89 
 90 /*-----------------------------------------------------------------------------
 91 * Id: arr_del F2
 92 *
 93 * Summary: Deleting item(s). The method removes an item with the specified
 94            number.
 95 *  
 96 * Params: num - The number of item starting from 0. 
 97 * 
 98 -----------------------------------------------------------------------------*/
 99 
100 method arr.del( uint num )
101 {
102    this.del( num, 1 )
103 }
104 
105 /*-----------------------------------------------------------------------------
106 * Id: arr_cut F2
107 *
108 * Summary: Reducing an array. All items exceeding the specified number will be
109            deleted. 
110 *  
111 * Params: count - The number of items left in the array. 
112 * 
113 -----------------------------------------------------------------------------*/
114 
115 method arr.cut( uint count )
116 { 
117    this.del( count, *this - 1 )
118 }
119 
120 /*-----------------------------------------------------------------------------
121 * Id: arr_move F2
122 *
123 * Summary: Move an item. 
124 *  
125 * Params: from - The current index of the item starting from zero.  
126           to - The new index of the item starting from zero. 
127 * 
128 -----------------------------------------------------------------------------*/
129 
130 method arr.move( uint from, uint to )
131 {
132    buf btemp
133    
134    if from == to || from >= *this : return   
135    
136    if to >= *this : to = *this - 1
137    
138    btemp.copy( this.index( from ), this.isize )
139    
140    if from > to
141    {
142       mmove( this.index( to + 1 ), this.index( to ), this.isize * ( from - to ))   }
143    else
144    {
145       mmove( this.index( from ), this.index( from + 1), 
146              this.isize * ( to - from ))   
147    }
148    mcopy( this.index( to ), btemp.ptr(), this.isize )
149 }
150 
151 /*-----------------------------------------------------------------------------
152 ** Id: arr_insert F2
153 *
154 * Summary: Insert elements. The method inserts an element into the array at 
155            the specified index.
156 *  
157 * Params: id - The index of the element needs to be inserted.  
158 * 
159 -----------------------------------------------------------------------------*/
160 
161 method arr.insert( uint id )
162 {
163    this.insert( id, 1 )
164 }
165 
166 operator arr of uint = ( arr left of uint, collection right )
167 {
168    uint i  
169  
170    fornum i=0, *right
171    {
172       if right.gettype(i) == uint || right.gettype(i) == int
173       {           
174          left += right[i]
175       }
176    }
177    return left->arr of uint
178 }
179 
180 /*operator arr of uint= ( arr left of uint, arr right of uint)
181 {
182    uint i  
183    left.clear()
184    left.expand(*right)
185    fornum i=0, *right
186    {
187       left[i] = right[i]      
188    }
189    return left->arr of uint
190 }*/
191 
192 /*Тип arr является встроенным, структура arr включена в компилятор
193 type <inherit = buf> {
194    uint    itype // The type of items
195    uint    isize // The size of the item
196    uint    dim[ MAX_MSR ]  // Dimensions   
197 }
198 В компилятор включены следующее методы и операции:
199 arr.del( uint from, uint number )
200 uint arr.expand( uint count )
201 arr.insert( uint from, uint number )
202 */
203 
Редактировать