EnglishРусский  

   ..

   cmdlist.c

   cmdlist.g

   cmdlist.h

   ge.h

   geasm.c

   geload.c

   gesave.c

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

Реклама

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

  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 * ID: geload 18.10.06 0.0.A.
 11 *
 12 * Author: Alexey Krivonogov ( gentee )
 13 *
 14 * Summary: 
 15 * 
 16 ******************************************************************************/
 17 
 18 #include "ge.h"
 19 #include "../vm/vmload.h"
 20 #include "../vm/vmres.h"
 21 #include "../vm/vmmanage.h"
 22 #include "../common/crc.h"
 23 
 24 void  STDCALL load_none( void )
 25 {
 26    pvmobj pvmo = ( pvmobj )vmmng_begin( sizeof( vmobj ));
 27 
 28    load_addobj( 0 );
 29    vmmng_end( ( pubyte )( pvmo + 1 ));
 30 }
 31 
 32 void STDCALL load_resource( pubyte* in )
 33 {
 34    uint count, i, type;
 35 
 36    *in += 5;
 37    count = load_bwd( in ); // skip size
 38    count = load_bwd( in );
 39    _vm.irescnv = collect_count( &_vm.resource );
 40 
 41    for ( i = 0; i < count; i ++ )
 42    {
 43       type = load_convert( in );
 44       if ( type == TStr )
 45       {
 46          vmres_addstr( *in );
 47 //         print("OK=%s %i\n", *in, _vm.rescnv[ i ] );
 48          *in += mem_len( *in ) + 1;
 49       }
 50    }
 51 }
 52 
 53 uint STDCALL ge_load( pbuf in )
 54 {
 55    pubyte   cur, end, ptemp;
 56    uint     size;
 57    pgehead  phead = ( pgehead )buf_ptr( in );
 58 
 59    // Проверка заголовка и целостности
 60    // Сравниваем с 'GE' с двумя нулями на конце
 61 
 62    if ( *( puint )phead != GE_STRING )//0x00004547 )
 63       msg( MNotGE | MSG_EXIT );
 64    if ( phead->crc != crc( ( pubyte )phead + 12, phead->size - 12, 0xFFFFFFFF ))
 65       msg( MCrcGE | MSG_EXIT );
 66    if ( phead->vermajor != GEVER_MAJOR || phead->verminor > GEVER_MINOR )
 67       msg( MVerGE | MSG_EXIT );
 68 
 69    _vm.loadmode = VMLOAD_GE;
 70    _vm.icnv = arr_count( &_vm.objtbl ) - KERNEL_COUNT;
 71 //   print("icnv=%i\n", _vm.icnv );
 72    cur = ( pubyte )phead + phead->headsize;
 73    end = ( pubyte )phead + phead->size;
 74    while ( cur < end )
 75    {
 76       ptemp = cur + 5; // type + flag
 77       _vm.ipack = ( *( puint )( cur + 1 )) & GHCOM_PACK ? 1 : 0;
 78 
 79       size = load_bwd( &ptemp );
 80       ptemp = cur;
 81 //      print("size=%i type=%i flag = %x\n", size, *cur, *( puint )( cur + 1 ) );
 82       switch ( *cur )
 83       {
 84          case OVM_NONE:
 85             load_none();
 86             break;
 87          case OVM_BYTECODE:
 88             load_bytecode( &cur, VMLOAD_GE );
 89             break;
 90          case OVM_EXFUNC:
 91             load_exfunc( &cur, 0 );
 92             _vm.loadmode = VMLOAD_GE;
 93             break;
 94         case OVM_TYPE:
 95             load_type( &cur );
 96             break;
 97         case OVM_GLOBAL:
 98             load_global( &cur );
 99             break;
100         case OVM_DEFINE:
101             load_define( &cur );
102             break;
103         case OVM_IMPORT:
104             load_import( &cur );
105             break;
106          case OVM_RESOURCE:
107             load_resource( &cur );
108             break;
109          case OVM_ALIAS:
110             load_alias( &cur );
111             break;
112          default: 
113             msg( MUnkGE | MSG_DVAL, cur - ( pubyte )phead );
114       }
115       cur = ptemp + size;
116    }
117    _vm.loadmode = VMLOAD_G;
118    _vm.icnv  = 0;
119    return 1;
120 }
Редактировать