Пример #1
0
void as3_init(const char *i_format_name, const char *i_codec_name, int i_sample_rate,
              int i_channels, const char *o_format_name, const char *o_codec_name,
              int o_sample_rate, int o_channels, int o_bit_rate, int o_buffer_max_seconds)
{
    AS3_MallocString(i_format_name, inputFormat);
    AS3_MallocString(i_codec_name, inputCodec);
    AS3_GetScalarFromVar(i_sample_rate, inputSampleRate);
    AS3_GetScalarFromVar(i_channels, inputChannels);
    AS3_MallocString(o_format_name, outputFormat);
    AS3_MallocString(o_codec_name, outputCodec);
    AS3_GetScalarFromVar(o_sample_rate, outputSampleRate);
    AS3_GetScalarFromVar(o_channels, outputChannels);
    AS3_GetScalarFromVar(o_bit_rate, outputBitRate);
    AS3_GetScalarFromVar(o_buffer_max_seconds, outputBufferMaxSeconds);

    int status = init(i_format_name, i_codec_name, i_sample_rate, i_channels, o_format_name,
         o_codec_name, o_sample_rate, o_channels, o_bit_rate, o_buffer_max_seconds);

    free((char*)i_format_name);
    free((char*)i_codec_name);
    free((char*)o_format_name);
    free((char*)o_codec_name);

    AS3_Return(status);
}
Пример #2
0
void initializeDiffuseBuffer_AS3()
{
	int* result;
	//get the pointer of the texture buffer
	result = initializeDiffuseBuffer(resX,resY);
	// return the result (using an AS3 return rather than a C/C++ return)
	AS3_Return(result);
}
void multipleSWC1()
{
    // simple return
    int result = 5;
    int squared = square1(result);
    // return the result (using an AS3 return rather than a C/C++ return)
    AS3_Return(result);
}
Пример #4
0
void as3_load_pointer(uint8_t *i_data, int i_length)
{
    AS3_GetScalarFromVar((uint8_t*)i_data, inputPointer);
    AS3_GetScalarFromVar(i_length, inputLength);
    
    int status = load(i_data, i_length);

    AS3_Return(status);
}
Пример #5
0
static void findTrampState() // find the TrampState * for a given tramp's fun ptr
{
  void *funPtr;
  AS3_GetScalarFromVar(funPtr, funPtr);
  void *entry = bsearch(&funPtr, s_trampImpls, AVM2_TRAMP_COUNT, sizeof(void *), ptrcomp);
  TrampState *state = s_trampStates + ((void **)entry - s_trampImpls);
#ifdef AVM2_TRAMP_TEST_LOG
  printf("findTrampState: funptr: %p entry: %p state: %p\n", funPtr, entry, state);
#endif
  AS3_Return(state);
}
Пример #6
0
void initializeScreenDiffuseBuffer_AS3()
{
	int* result;
	//copy the AS3 resolution variables resX0, resY0 (parameters of the swc function initializeScreenDiffuseBuffer_AS3) 
	//to C variables resX, resY in lookupeffect.c
	AS3_GetScalarFromVar(resX,resX0);
	AS3_GetScalarFromVar(resY,resY0);
	//get the pointer of the screen buffer
	result = initializeScreenDiffuseBuffer(resX,resY);
	// return the result (using an AS3 return rather than a C/C++ return)
	AS3_Return(result);
}
Пример #7
0
void scws_send_text_AS3()
{
	char *text = NULL;
	AS3_MallocString(text, inputString);
	scws_send_text(s, text, strlen(text));
	AS3_DeclareVar(myString, String);

	//char *result;
	//result[0] = '\0';   // ensures the memory is an empty string
	char result[5000]={"0"};
    char temp[1000]={'\0'};
	printf("%s",result);
	while (res = cur = scws_get_result(s))
	{
		while (cur != NULL)
		{
			printf("WORD: %.*s/%s (IDF = %4.2f)\n", cur->len, text+cur->off, cur->attr, cur->idf);
			//if((result = malloc(strlen(result)+ cur->len +1)) != NULL){
			//if((result = (char*) realloc(strlen(result)+ (cur->len) +1)) != NULL)
            strncpy(temp, text+cur->off, cur->len);
			temp[(cur->len)+1]='\0';
			strcat(result, temp);
			strcat(result, ' ');
			strcat(result, '\0');
            //strncpy(new_str,str2);
            //} else {
            //printf("malloc failed!\n");
            // exit?
            //}
			cur = cur->next;
		}
		scws_free_result(res);
	}
	strcat(result, '\0');
	
	printf("%s",result);
	AS3_CopyCStringToVar(myString, result, strlen(result));
	scws_free(s);
	//scws_free(result);
	AS3_Trace(myString);
	
	AS3_Return("212");
}
Пример #8
0
void MurmurHash3()
{
    // Copy the AS3 string to the C heap (must be free'd later)
    char *key = NULL;
    AS3_MallocString(key, keystr);

    int keylen = 0;
    AS3_StringLength(keylen, keystr);
    
    // Call hash function
    int result;
    uint32_t seed = 42;
    MurmurHash3_x86_32(key, keylen, seed, &result);
    
    // don't forget to free the string we allocated with malloc previously
    free(key);
    
    // return the result (using an AS3 return rather than a C/C++ return)
    AS3_Return(result);
}
Пример #9
0
void as3_get_output_sample_rate()
{
    int o_sample_rate = get_output_sample_rate();
    AS3_Return(o_sample_rate);
}
Пример #10
0
void as3_get_load_locked_status()
{
    int status = get_load_locked_status();
    AS3_Return(status);
}
Пример #11
0
void as3_get_output_length()
{
    int o_length = get_output_length();
    AS3_Return(o_length);
}
Пример #12
0
void as3_get_output_pointer()
{
    int o_pointer = (int)get_output_pointer();
    AS3_Return(o_pointer);
}
Пример #13
0
void as3_get_output_channels()
{
    int o_channels = get_output_channels();
    AS3_Return(o_channels);
}
Пример #14
0
void foo()
{
  SomeClass sc;
  AS3_Return(13);
}
void _localvar_alloc()
{
	AS3_Return(new AS3::local::var());
}