Beispiel #1
0
extern "C" void equ_makeTable(SuperEqState *state, REAL *lbc,void *_param,REAL fs)
{
  paramlist *param = (paramlist *)_param;
  int i,cires = state->cur_ires;
  REAL *nires;

  if (fs <= 0) return;

  paramlist param2;

  for (int ch = 0; ch < state->channels; ch++) {
      process_param(lbc,param,param2,fs,ch);

      for(i=0;i<state->winlen;i++)
          state->irest[i] = hn(i-state->winlen/2,param2,fs)*win(i-state->winlen/2,state->winlen);

      for(;i<state->tabsize;i++)
          state->irest[i] = 0;

      rfft(state->fft_bits,1,state->irest);

      nires = cires == 1 ? state->lires2 : state->lires1;
      nires += ch * state->tabsize;

      for(i=0;i<state->tabsize;i++)
          nires[i] = state->irest[i];
  }
  state->chg_ires = cires == 1 ? 2 : 1;
}
Beispiel #2
0
void equ_makeTable(REAL *lbc,REAL *rbc,paramlist *param,REAL fs)
{
  int i,cires = cur_ires;
  REAL *nires;

  if (fs <= 0) return;

  paramlist param2;

  // L

  process_param(lbc,param,param2,fs,0);
  
  for(i=0;i<winlen;i++)
    irest[i] = hn(i-winlen/2,param2,fs)*win(i-winlen/2,winlen);

  for(;i<tabsize;i++)
    irest[i] = 0;

  rfft(tabsize,1,irest);

  nires = cires == 1 ? lires2 : lires1;

  for(i=0;i<tabsize;i++)
    nires[i] = irest[i];

  process_param(rbc,param,param2,fs,1);

  // R
  
  for(i=0;i<winlen;i++)
    irest[i] = hn(i-winlen/2,param2,fs)*win(i-winlen/2,winlen);

  for(;i<tabsize;i++)
    irest[i] = 0;

  rfft(tabsize,1,irest);

  nires = cires == 1 ? rires2 : rires1;

  for(i=0;i<tabsize;i++)
    nires[i] = irest[i];
   
  //
  
  chg_ires = cires == 1 ? 2 : 1;
}
Beispiel #3
0
int
process_set_values(char *data, olsr_u32_t data_size, char *buf, olsr_u32_t bufsize __attribute__((unused)))
{
  int size = 0;
  int val_start, key_start;
  olsr_u32_t i;

  size += sprintf(buf, "<html>\n<head><title>olsr.org httpinfo plugin</title></head>\n<body>\n");

  key_start = 0;
  val_start = 0;

  for(i = 0; i < data_size; i++)
    {
      if(data[i] == '=')
	{
	  data[i] = '\0';
	  val_start = i + 1;
	}

      if(data[i] == '&')
	{
	  data[i] = '\0';
	  if(!process_param(&data[key_start], &data[val_start]))
	    {
	      size += snprintf(&buf[size], bufsize-size, "<h2>FAILED PROCESSING!</h2><br>Key: %s Value: %s<br>\n", 
			      &data[key_start], &data[val_start]);
	      return -1;
	    }

	  key_start = i + 1;
	}
    }  

  if(!process_param(&data[key_start], &data[val_start]))
    {
      size += snprintf(&buf[size], bufsize-size, "<b>FAILED PROCESSING!</b><br>Key: %s Value: %s<br>\n", 
		      &data[key_start], &data[val_start]);
      return -1;
    }

  size += snprintf(&buf[size], bufsize-size, "<h2>UPDATE SUCESSFULL!</h2><br>Press BACK and RELOAD in your browser to return to the plugin<br>\n</body>\n</html>\n");
  size += snprintf(&buf[size], bufsize-size, "\n</body>\n</html>\n");

  return size;
}
Beispiel #4
0
//-------------------------------------------------------------------
// PURPOSE: Parse script (script_source_str) for @xxx
// PARAMETERS:  fn - full path of script
// RESULTS:  script_title
//           script_params
//           script_params_order
//           script_loaded_params, conf.script_vars
//-------------------------------------------------------------------
static void script_scan(const char *fn)
{
    register const char *ptr = script_source_str;
    register int i, j=0, n;
    char *c;

    if ( !ptr ) { ptr = lua_script_default; }     // sanity check

    // Build title

    c=strrchr(fn, '/');
    strncpy(script_title, (c)?c+1:fn, sizeof(script_title));
    script_title[sizeof(script_title)-1]=0;

    // Reset everything

    for (i=0; i<SCRIPT_NUM_PARAMS; ++i)
    {
        conf.script_vars[i] = 0;
        script_loaded_params[i] = 0;
        script_params[i][0]=0;
        script_param_order[i]=0;
        script_range_values[i] = 0;
        if (script_named_values[i]) free(script_named_values[i]);
        script_named_values[i] = 0;
        if (script_named_strings[i]) free(script_named_strings[i]);
        script_named_strings[i] = 0;
        script_named_counts[i] = 0;
    }

    // Fillup order, defaults

    while (ptr[0])
    {
        ptr = skip_whitespace(ptr);
        if (ptr[0]=='@') {
            if (strncmp("@title", ptr, 6)==0)
            {
                process_title(ptr+6);
            }
            else if (strncmp("@param", ptr, 6)==0)
            {
                n = process_param(ptr+6); // n=1 if '@param a' was processed, n=2 for 'b' ... n=26 for 'z'. n=0 if failed.
                if (n>0 && n<=SCRIPT_NUM_PARAMS)
                {
                  script_param_order[j]=n;
                  j++;
                }
            }
            else if (strncmp("@default", ptr, 8)==0)
            {
                process_default(ptr+8);
            }
            else if (strncmp("@range", ptr, 6)==0)
            {
                process_range(ptr+6);
            }
            else if (strncmp("@values", ptr, 7)==0)
            {
                process_values(ptr+7);
            }
        }
        ptr = skip_eol(ptr);
    }
}
Beispiel #5
0
main ( int argc, char **argv)
	{
	time_t r;
	int a, b, c, d, e;
	char time_string[100];
	
	Parameter *PARAM;    	    	    	
    	
	
	
	PARAM=declare_parameter();
	get_ref_time (PARAM);

	argv=break_list ( argv, &argc, "=:;,");
	process_command_line ( argc,argv, PARAM);
	read_command_line    ( argc,argv, PARAM);
	
	fprintf ( stderr, "\nFINISHED READING PARAMETERS");

	declare_dos_2 ( PARAM);
	
	INTERACTIVE_PROMPT_SET=(PARAM->BGA)->INTERACTIVE;
	
	if ( (PARAM->BGA)->OUTPUT_SCREEN==0)
		{
		(PARAM->std0)=stderr;
		(PARAM->std1)=(PARAM->std2)=fopen ( "/dev/null", "w");
		}
	else if ( (PARAM->BGA)->OUTPUT_SCREEN==1)
		{
		(PARAM->std0)=(PARAM->std1)=stderr;
		(PARAM->std2)=fopen ( "/dev/null", "w");
		}
	else if ((PARAM->BGA)->OUTPUT_SCREEN==2)
		{
		(PARAM->std0)=(PARAM->std1)=(PARAM->std2)=stderr;
		}
		
	time(&r);
	sprintf ( time_string, "%d", (int) r);
	PARAM->START=r;
	
	if ( (PARAM->BGA)->RANDOM_SEED >0)
		{addrandinit ( (unsigned long) (PARAM->BGA)->RANDOM_SEED);
	 	if ( ((PARAM->BGA)->OUTPUT_SCREEN)==1)printf ( "\nRANDOM_SEED= %d",(PARAM->BGA)->RANDOM_SEED);
		} 
    	else if ( (PARAM->BGA)->RANDOM_SEED== -1)
		{
		
		b=0;
		for ( a= strlen ( time_string)-1; a>=strlen ( time_string)-3; a--)
	    	time_string[b++]= time_string[a];   
		time_string[b]='\0';
		(PARAM->BGA)->RANDOM_SEED= atoi ( time_string);
		addrandinit ( (unsigned long) (PARAM->BGA)->RANDOM_SEED);
		fprintf ((PARAM->std1), "\nRANDOM_SEED(undet)= %d",(PARAM->BGA)->RANDOM_SEED);
		}
		
	process_param (PARAM);
	input_data (PARAM);
	main_do_aln (PARAM);
	}
Beispiel #6
0
//-------------------------------------------------------------------
// PURPOSE: Parse script (conf.script_file) for parameters and title
//-------------------------------------------------------------------
static void script_scan()
{
    // Reset everything
    sc_param *p = script_params;
    while (p)
    {
        if (p->name)       free(p->name);
        if (p->desc)       free(p->desc);
        if (p->options)    free(p->options);
        if (p->option_buf) free(p->option_buf);
        sc_param *l = p;
        p = p->next;
        free(l);
    }
    script_params = tail = 0;
    script_param_count = 0;

    parse_version(&script_version, "1.3.0.0", 0);
    script_has_version = 0;
    is_script_loaded = 0;

    // Load script file
    const char *buf=0;
    if (conf.script_file[0] != 0)
        buf = load_file_to_length(conf.script_file, 0, 1, 4096);    // Assumes parameters are in first 4K of script file

    // Check file loaded
    if (buf == 0)
    {
        strcpy(script_title, "NO SCRIPT");
        return;
    }

    // Build title from name (in case no title in script)
    const char *c = get_script_filename();
    strncpy(script_title, c, sizeof(script_title)-1);
    script_title[sizeof(script_title)-1]=0;

    // Fillup order, defaults
    const char *ptr = buf;
    while (ptr[0])
    {
        ptr = skip_whitespace(ptr);
        if (ptr[0] == '@')
        {
            if (strncmp("@title", ptr, 6)==0)
            {
                process_title(ptr+6);
            }
            else if (strncmp("@subtitle", ptr, 9)==0)
            {
                process_subtitle(ptr+9);
            }
            else if (strncmp("@param", ptr, 6)==0)
            {
                process_param(ptr+6);
            }
            else if (strncmp("@default", ptr, 8)==0)
            {
                process_default(ptr+8, 1);
            }
            else if (strncmp("@range", ptr, 6)==0)
            {
                process_range(ptr+6);
            }
            else if (strncmp("@values", ptr, 7)==0)
            {
                process_values(ptr+7);
            }
            else if (strncmp("@chdk_version", ptr, 13)==0)
            {
                ptr = skip_whitespace(ptr+13);
                parse_version(&script_version, ptr, 0);
                script_has_version = 1;
            }
        }
        else if (ptr[0] == '#')
        {
            process_single(ptr+1);
        }
        ptr = skip_eol(ptr);
    }

    free((void*)buf);
    is_script_loaded = 1;
}