int main(void) {
    int array[10] = {3, 5, 1, 4, 5, 2, 4, 7, 12, 13};
    printa(array, 10);
    bubble(array, 10);
    printa(array, 10);
    return 0;
}
Beispiel #2
0
int main(int argc, char* argv[])
{
	int a[MAX_NUMBERS];
	int i;
	int min = 1;
	int max = 99;

	printf("%i random numbers from %i to %i:\n", MAX_NUMBERS, min, max);

	// initializes random number generator
	srand((unsigned)time(NULL));

	// generate random number
	for (i = 0; i < MAX_NUMBERS; i++)
		a[i] = min + rand() % (max - 1);

	// print the numbers
	printa(MAX_NUMBERS, a);

	// sorting
	quicksort(a, 0, MAX_NUMBERS);

	printf("%i ordered random numbers from %i to %i:\n", MAX_NUMBERS, min, max);

	// print the ordered numbers
	printa(MAX_NUMBERS, a);

	printf("Press [ENTER] to quit\n");
	getchar();
	exit(EXIT_SUCCESS);
}
Beispiel #3
0
int main(){
	a[11] = 5;
	printa(a);

	int b[10] = {0,1,2,3,4,5,6,7,8,9};
	b[11] = 5;
	printa(b);

	int *c = malloc(10*sizeof(int));
	c[11] = 5;
	printa(c);
}
Beispiel #4
0
int main () {
  struct dati d;
   const char src[256] = "batmanandrobin%40yahoo.com";
   funz(&d, src );
   printa(d.dato, d.lung);
   return(0);
}
Beispiel #5
0
static void gen_at_end( const act* action, int column)
{
	TEXT s[MAX_REF_SIZE];

	const gpre_req* request = action->act_request;
	printa(column, "if (!%s) ", gen_name(s, request->req_eof));
}
Beispiel #6
0
static int goni_rt5640_init_paifrx(struct snd_soc_pcm_runtime *rtd)
{
	struct snd_soc_codec *codec = rtd->codec;
	struct snd_soc_dapm_context *dapm = &codec->dapm;

	printa("goni play new_controls\n"); 
	snd_soc_dapm_new_controls(dapm, goni_dapm_widgets_pbk, ARRAY_SIZE(goni_dapm_widgets_pbk));

	printa("goni play add_routes\n");
	snd_soc_dapm_add_routes(dapm, goni_map_rx, ARRAY_SIZE(goni_map_rx));

	printa("goni play snd_soc_dapm_sync\n");
  	snd_soc_dapm_sync(dapm);
	
	return 0;
}
Beispiel #7
0
int main()
{
    int N = 50;
    
    int PenDrive = 4000;
    int *Arquivos = (int*)malloc(sizeof(int) * N);
    GenerateFiles(Arquivos, N, 300);

    int *Arq = Sort(Arquivos,N);


    printf("Total espeaço: %i\n", PenDrive);
    printa(Arq, N);

    int soma = 0, i=0;
    soma = Sum(Arq,N);
    printf("Total Arquivos (MB): %i \n",soma);

    for(i=0;i<N ;i++)
        if(PenDrive >= Arq[i]){
            printf("+ %i MB\n", Arq[i]);
            PenDrive -= Arq[i];
            Arq[i] = 0;
        }

    printf("Sobrou (MB): %i \n",PenDrive);

    soma= Sum(Arq,N);
    printf("Sobrou %i MB nos Arquivos!\n",soma);
    return 0;
}
Beispiel #8
0
 void run()
 {
 	int a[500]={0},i,j,len=1,tmp=0;
	a[1]=1;
 	for(i=n+2;i<=2*n;i++){
		for(j=1;j<=len;j++)
			a[j]*=i;
		for(j=1;j<=len;j++){
			a[j+1]+=a[j]/10;
			a[j]%=10;
		}
		while(a[j]){
			a[j+1]+=a[j]/10;
			a[j]%=10;
			j++;
		}
		len=j-1;
		//printa(a,len);
	}
	for(i=2;i<=n;i++){
		for(j=len;j>=1;j--){
			tmp*=10;
			tmp+=a[j];
			a[j]=tmp/i;
			tmp%=i;
		}
		while(a[len]==0) len--;
	}
	printa(a,len);
 }
Beispiel #9
0
static int user_isr(unsigned line) {
	(void)line;
	if (++ticks%8 == 0) {
		printa("%x ticks\n", ticks);
	}
	return 0;
}
Beispiel #10
0
void printa(int m[ROWS][COLS], int i, int j, int cor, int fundo) {

  // TM_PRINTF("Received i[%d] j[%d] cor[%d] fundo[%d] \n", i, j, cor, fundo);

  printa_matriz(m, i, j);

  m[i][j] = cor;

  // cima
  if (i > 0 && m[i-1][j] == fundo) printa(m, i - 1, j, cor, fundo);
  // dir
  if (j < (COLS - 1) && m[i][j+1] == fundo) printa(m, i, j + 1, cor, fundo);
  // baixo
  if (j < (ROWS + 1) && m[i+1][j] == fundo) printa(m, i + 1, j, cor, fundo);
  // esq
  if (j < (COLS + 1) && m[i][j-1] == fundo) printa(m, i, j - 1, cor, fundo);
}
Beispiel #11
0
int main()
{
    const int n = 10;
    double a[n];
    int i = 0, m;
    char buf[BUFSIZ];

    while(fgets(buf,BUFSIZ,stdin))
    {
        a[i] = atoi(buf);
        if(++i >= n) break;
    }
    m = i;
    printa(a,m);
    buble(a,m);
    printa(a,m);
    return 0;
}
Beispiel #12
0
void funz (struct dati *d, const char *src) {
   char substitute[] = "@";
   //char d->dato[256];
   char *ret;
   int len;
   int diff;

   len = strlen(src);
   ret = memchr(src, '%', len);
   diff = ret - src;

   memcpy(d->dato, src, diff);
   printa(d->dato, diff);
   memcpy(d->dato + diff, substitute, 1);
   printa(d->dato, diff +1);
   memcpy(d->dato + diff + 1, ret+3, len-diff-3);
   printa(d->dato, len - 3 +1);
   d->lung = len  - 3 + 1;
}
Beispiel #13
0
int main(){
system("clear");	
	srand (time(NULL));
	
	int m1[ORD][ORD], m2[ORD][ORD], m3[ORD][ORD], i, j, digitado;	
	
	//SORTEIA AS MATRIZES M1 E M2
	for (i=0; i<ORD; i++)
	{
		for (j=0; j<ORD; j++)
		{
		m1[i][j] = rand()%5;
		m2[i][j] = rand()%5;
		}
	}

	do
	{	
	        printf("---------- Digite o número da opção desejada ----------\n");
	        printf("|                                                     |\n");
	        printf("|         1 - Somar                                   |\n");
	        printf("|         2 - Subtrair                                |\n");
	        printf("|         3 - Adicionar uma constante                 |\n");
	        printf("|         4 - Imprimir as matrizes                    |\n");
	        printf("|         5 - Sair                                    |\n");
	        printf("|                                                     |\n");
	        printf("-------------------------------------------------------\n");	
		scanf("%d", &digitado);
		
		system("clear");
	
		switch (digitado)
		{
	
		case 1:	
		soma(&m1[0][0],&m2[0][0],&m3[0][0]);
		break;
	
		case 2:
		subtrai(&m1[0][0],&m2[0][0],&m3[0][0]);	
		break;	
	
		case 3:
		addk(&m1[0][0],&m2[0][0]);
		break;
	
		case 4:
		printa(&m1[0][0], &m2[0][0], &m3[0][0]);
		break;
		}
	}
	while (digitado != 5);
	
return(0);
}
Beispiel #14
0
int main()
{
    printint(42);
    printa(3);
    //Undefined function printa(<int>) line 7, column 5.

    floa a;
    //Undefined type floa line 10, column 5.

    var;
    //`var` undeclared line 13, column 5.
}
Beispiel #15
0
/* Initialize all services and execute user level code */
void init_systems(void) {
	if (!fork()) {
		do {
			sys_exec("user/services/pipe_master");
			printa("pipe_master error\n");
		} while (1);
	}
	if (!fork())
		sys_exec("user/user_first");

	while (1);
}
Beispiel #16
0
static int mixtile_rt5640_init_paiftx(struct snd_soc_pcm_runtime *rtd)
{
	struct snd_soc_codec *codec = rtd->codec;
	struct snd_soc_dapm_context *dapm = &codec->dapm;

	printa("mixtile capture new control\n");
	snd_soc_dapm_new_controls(dapm, rt5640_dapm_widgets_cpt, ARRAY_SIZE(rt5640_dapm_widgets_cpt));

	printa("mixtile capture add_routes\n");
  if(dev_ver == 1)
    snd_soc_dapm_add_routes(dapm, audio_map_tx_htpc, ARRAY_SIZE(audio_map_tx_htpc));
  else
    snd_soc_dapm_add_routes(dapm, audio_map_tx, ARRAY_SIZE(audio_map_tx));
  
  	printa("mixtile capture snd_soc_dapm_sync\n");
	snd_soc_dapm_sync(dapm);

	

	return 0;
}
Beispiel #17
0
int main() {

  int a[ROWS][COLS] = {
    {0, 0, 2, 1, 1},
    {1, 0, 2, 0, 0},
    {1, 0, 0, 0, 2},
    {1, 0, 2, 0, 2},
    {1, 0, 0, 0, 1}
  };

  printa(a, 1, 1, 5, 0);

  return 0;
}
Beispiel #18
0
/* Initialize all kernel subsystems and run system */
int main(void) {
	printa("In main %x\n", (unsigned)main);
	init_int();
	init_page_alloc();
	init_pipes();
	init_scheduler();

	add_task(&init_systems);

	while (1) {
		schedule();
	}

	return 0;
}
//#ifndef CONFIG_SND_SAMSUNG_I2S_MASTER  
//kaixian@cellon modify hw params as master
static int smdk_hw_master_params(struct snd_pcm_substream *substream,
	struct snd_pcm_hw_params *params)
{
	struct snd_soc_pcm_runtime *rtd = substream->private_data;
	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
	struct snd_soc_dai *codec_dai = rtd->codec_dai;
	unsigned int pll_out;
	int ret;

	printa("[zsb] smdk_hw_params : codec master\n");
	/* AIF1CLK should be >=3MHz for optimal performance */
	if (params_rate(params) == 8000 || params_rate(params) == 11025)
		pll_out = params_rate(params) * 512;
	else
		pll_out = params_rate(params) * 256;

	ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S
					 | SND_SOC_DAIFMT_NB_NF
					 | SND_SOC_DAIFMT_CBM_CFM);
	if (ret < 0)
		return ret;

	ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S
					 | SND_SOC_DAIFMT_NB_NF
					 | SND_SOC_DAIFMT_CBM_CFM);
	if (ret < 0)
		return ret;

	ret = snd_soc_dai_set_pll(codec_dai, WM8994_FLL1, WM8994_FLL_SRC_MCLK1,
					SMDK_WM8994_FREQ, pll_out);
	if (ret < 0)
		return ret;

	ret = snd_soc_dai_set_sysclk(codec_dai, WM8994_SYSCLK_FLL1,
					pll_out, SND_SOC_CLOCK_IN);
	if (ret < 0)
		return ret;

	ret = snd_soc_dai_set_sysclk(cpu_dai, SAMSUNG_I2S_OPCLK,
					0, MOD_OPCLK_PCLK);
	if (ret < 0)
		return ret;

	return 0;
}
Beispiel #20
0
static void gen_request( const gpre_req* request)
{

	if (!(request->req_flags & REQ_exp_hand))
		fprintf(gpreGlob.out_file, "static void\t*%s;\t// request handle \n", request->req_handle);

	fprintf(gpreGlob.out_file, "static const UCHAR\tjrd_%"ULONGFORMAT" [%d] =",
			   request->req_ident, request->req_length);
	align(INDENT);
	fprintf(gpreGlob.out_file, "{\t// blr string \n");

	if (gpreGlob.sw_raw)
		gen_raw(request);
	else
		fb_print_blr(request->req_blr, request->req_length, gen_blr, 0, 0);

	printa(INDENT, "};\t// end of blr string \n");
}
Beispiel #21
0
void runlargetest()
{
    /* Create a ring buffer with size equal to the LMC ring buffer. */
    int size = 700;
    int readsize = 32;
    void *tres;
    unsigned short int *datar;
    /* Create garbage data to pump into the buffer. */
    unsigned short int datas[64] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','1','2','3','4','5','6','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','1','2','3','4','5','6'};
    assert(rbcreate(size) == 0);
    printing = 0;
    /* Create thread and start it. */
    running = 1;
    working = 1;
    if (pthread_create(&streamingthread, NULL, datathread, NULL) == -1) {
        printf("Failed to start thread.\n");
        return;
    }
    done = 0;
    /* Print the whole buffer. */
    /* printa(rb, 64); */
    /* Request 32 bytes at a time and print out the data and the buffer. */
    while (working);
    printing = 1;
    printf("Done initial work.\n");
    while (1) {
        printing = 1;
        if (rbret(&datar, 32) == 0) {
            printa(datar, 32);
            printf("\n");
        }
        printing = 0;
        if (done)
            break;
    }
    /* Stop the thread. */
    running = 0;
    if (pthread_join(streamingthread, &tres) != 0) {
        printf("Hmm\n");
    } else {
        printf("Stream not running.\n");
    }
}
Beispiel #22
0
static int rt5640_up_event(struct snd_soc_dapm_widget *w,
			     struct snd_kcontrol *kcontrol, int event)
{
	struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(w->codec);

#ifdef MUTE_EVENT
	switch (event) {
	case SND_SOC_DAPM_POST_PMU:
		gpio_set_value(MUTE_GPIO, 1);
		printa("gong fang UN-MUTE ,POST_PMU\n");
		break;
/*	case SND_SOC_DAPM_PRE_PMD:
		gpio_set_value(MUTE_GPIO, 0); 
		printa("gong fang MUTE , PRE_PMD \n");
		break;*/
	default:
		return 0;
	}
#endif
	return 0;
}
funcp geracod (FILE *myfp) {
            
	int line = 1;            
	char c;           
	unsigned char *codigo;           
	int j=0;		
	int linha[50],jumps[50][2],qtdJump=0;

			
	codigo = (unsigned char*) malloc (4096 * sizeof(unsigned char));
			
	if (codigo == NULL)				
		exit(1);		
			
	j= entrada_saida(codigo,entrada,j,1);			
	linha[0]=-1;
			
	while ((fscanf(myfp," %c",&c)) != EOF) {
			
		linha[line] = j;			
		printf("C: %c\n",c);          
		switch (c) {          
		
		case 'r': {                   
			char var1[100];               
                 
			if (fscanf(myfp,"et %s",var1)!=1)                         
				error("comando invalido i",line);                  
					
			j = move_reg(codigo,var1,j,1,line);					
			j=  entrada_saida(codigo,saida,j,0);  					
			break;				  
				  }
     
    /************************** COMPARAÇAO *****************************/
          
		case 'i': { 
                     
			char var1[100],var2[100];                     
			int posJump;    
                      
			if ( fscanf(myfp,"feq %s %s %d",var1,var2,&posJump) != 3)                    
				error("comando invalido i",line);   

			/***** Movendo var1 para o %eax *******/                  
			j= move_reg(codigo,var1,j,1,line); 
 
            /********** Movendo var2 para o %ecx ************/					   
			j= move_reg(codigo,var2,j,0,line);
                       
            /********* Comparando %eax com %ecx E JE(jump equal) ****************/               
			codigo[j]=0x39;            
			codigo[j+1]=0xc1;            
			j+=2;

			/*	Guarda na matriz jumps a linha para onde deseja se desviar o controle, e aonde começa o jump (JE) */         								
			
			jumps[qtdJump][0]= posJump;			
			jumps[qtdJump][1]= j;			
			qtdJump++;			
			codigo[j]=0x0f;			
			codigo[j+1]=0x84;			
			j+=6;          
			break;
				  }
    /*************************** ATRIBUIÇÃO **************************/  
		case 'v': case 'p': case '$': {   
                                    
			char var1[100],var2[100],op;            
			int ind

			if (fscanf(myfp,"%d := %s %c %s",&ind,var1,&op,var2)!=4)            
				error("comando invalido i",line);  
                   
            /* Movendo var1 para o eax */               
			j = move_reg(codigo,var1,j,1,line);
                                    
            /* Fazendo OP var2, %eax */                   			
			j = op_reg(codigo,var2,op,j,line);

            /* MOVENDO PARA VAR */        
			codigo[j]=0x89;            
			codigo[j+1]=0x45;            
			j+=2;    
            
			if (c == 'p' && ind >= 0 && ind < 5)            
				codigo[j] = ind*4 +8;    
                
			else if (c == 'v' && ind >= 0 && ind < 5)            
				codigo[j] = 252 - ind*4;                
			else            
				error("operando invalido", line);  
                
			j++;                                  
			break;          
				  }         
		default: error("desconhecido", line);   
		}       
		line ++; 
	}
  
	printa(codigo,j); 	

	for (j=0; j<qtdJump ; j++) {	
		*((int *) &codigo[ jumps[j][1]+2 ]) = (int) &codigo [ linha[ jumps[j][0]  ] ] - (int) &codigo[ jumps[j][1]+6 ]   ;
		 /*
			>>jumps[j][0] tem a linha que se deve desviar o controle
			>>linha[..] tem o indice de onde o comando em Minima na linha .. começa no vetor codigo

			logo, &codigo [ linha[ jumps[j][0]  ] ] é o endereço da instrução para onde deve se desviar o controle

			&codigo[ jumps[j][1]+5 ] é o endereço da proxima instrução

		   &codigo[ jumps[j][1]+1 ] é o endereço de onde deve ser posto a diferença dos dois */
	}
	printa(codigo,j);
	return (funcp) codigo;   
}
	/* AIF1CLK should be >=3MHz for optimal performance */
	if (params_rate(params) == 8000 || params_rate(params) == 11025)
		pll_out = params_rate(params) * 512;
	else
		pll_out = params_rate(params) * 256;

	ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S
					 | SND_SOC_DAIFMT_NB_NF
					 | SND_SOC_DAIFMT_CBM_CFM);
	if (ret < 0)
		return ret;

	ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S
					 | SND_SOC_DAIFMT_NB_NF
					 | SND_SOC_DAIFMT_CBM_CFM);
	if (ret < 0)
		return ret;

	ret = snd_soc_dai_set_pll(codec_dai, WM8994_FLL1, WM8994_FLL_SRC_MCLK1,
					SMDK_WM8994_FREQ, pll_out);
	if (ret < 0)
		return ret;

	ret = snd_soc_dai_set_sysclk(codec_dai, WM8994_SYSCLK_FLL1,
					pll_out, SND_SOC_CLOCK_IN);
	if (ret < 0)
		return ret;

	ret = snd_soc_dai_set_sysclk(cpu_dai, SAMSUNG_I2S_OPCLK,
					0, MOD_OPCLK_PCLK);
	if (ret < 0)
		return ret;

	return 0;
}

//#else /* CONFIG_SND_SAMSUNG_I2S_MASTER */
static int smdk_hw_params(struct snd_pcm_substream *substream,
	struct snd_pcm_hw_params *params)
{
	struct snd_soc_pcm_runtime *rtd = substream->private_data;
	struct snd_soc_dai *codec_dai = rtd->codec_dai;
	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
	int bfs, psr, rfs, ret;
	unsigned long rclk;
	unsigned int pll_out;

	/* AIF1CLK should be >=3MHz for optimal performance */
	if (params_rate(params) == 8000 || params_rate(params) == 11025)
		pll_out = params_rate(params) * 512;
	else
		pll_out = params_rate(params) * 256;


	printa("[zsb] smdk_hw_params : codec slave\n");
	switch (params_format(params)) {
	case SNDRV_PCM_FORMAT_U24:
	case SNDRV_PCM_FORMAT_S24:
		bfs = 48;
		break;
	case SNDRV_PCM_FORMAT_U16_LE:
	case SNDRV_PCM_FORMAT_S16_LE:
		bfs = 32;
		break;
	default:
		return -EINVAL;
	}

	printa("[zsb] smdk_hw_params rate : %d\n", params_rate(params));
	switch (params_rate(params)) {
	case 16000:
	case 22050:
	case 24000:
	case 32000:
	case 44100:
	case 48000:
	case 88200:
	case 96000:
		if (bfs == 48)
			rfs = 384;
		else
			rfs = 256;
		break;
	case 64000:
		rfs = 384;
		break;
	case 8000:
	case 11025:
	case 12000:
		if (bfs == 48)
			rfs = 768;
		else
			rfs = 512;
		break;
	default:
		return -EINVAL;
	}

	rclk = params_rate(params) * rfs;

	switch (rclk) {
	case 4096000:
	case 5644800:
	case 6144000:
	case 8467200:
	case 9216000:
		psr = 8;
		break;
	case 8192000:
	case 11289600:
	case 12288000:
	case 16934400:
	case 18432000:
		psr = 4;
		break;
	case 22579200:
	case 24576000:
	case 33868800:
	case 36864000:
		psr = 2;
		break;
	case 67737600:
	case 73728000:
		psr = 1;
		break;
	default:
		printk("Not yet supported!\n");
		return -EINVAL;
	}
	//liyang: don't change epll when system running
	//set_epll_rate(rclk * psr);
	wm8994_i2s_master_set_epll_rate();

	ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S
					| SND_SOC_DAIFMT_NB_NF
					| SND_SOC_DAIFMT_CBS_CFS);
	if (ret < 0){
		printk("snd_soc_dai_set_fmt 1 fail!!!!!!\n");
		return ret;
	}

	ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S
					| SND_SOC_DAIFMT_NB_NF
					| SND_SOC_DAIFMT_CBS_CFS);
	if (ret < 0){
		printk("snd_soc_dai_set_fmt 2 fail!!!!!!\n");		
		return ret;
	}

//zkx add 
	ret = snd_soc_dai_set_pll(codec_dai, WM8994_FLL1, WM8994_FLL_SRC_MCLK1,     
					SMDK_WM8994_FREQ, pll_out);                                        

	if (ret < 0){
		printk("snd_soc_dai_set_pll WM8994_FLL1 fail!!!!!!\n");		
		return ret;
	}

//zkx add end

//zkx delete for clk change
//	ret = snd_soc_dai_set_sysclk(codec_dai, WM8994_SYSCLK_MCLK1,
//					rclk, SND_SOC_CLOCK_IN);

//zkx modify input clk
	ret = snd_soc_dai_set_sysclk(codec_dai, WM8994_SYSCLK_FLL1,
					pll_out, SND_SOC_CLOCK_IN);
					
	
	if (ret < 0){
		printk("snd_soc_dai_set_sysclk 1 fail!!!!!!\n");		
		return ret;
	}

	ret = snd_soc_dai_set_sysclk(cpu_dai, SAMSUNG_I2S_CDCLK,
					0, SND_SOC_CLOCK_OUT);
	if (ret < 0){
		printk("snd_soc_dai_set_sysclk 2 fail!!!!!!\n");		
		return ret;
	}
	
	ret = snd_soc_dai_set_clkdiv(cpu_dai, SAMSUNG_I2S_DIV_BCLK, bfs);
	
	if (ret < 0){
		printk("snd_soc_dai_set_clkdiv 1 fail!!!!!!\n");		
		return ret;
	}

	printa("[zsb] pos6\n");
	

	ret = snd_soc_dai_set_clkdiv(cpu_dai, SAMSUNG_I2S_DIV_PRESCALER, psr);		// zsb add important
	if (ret < 0)
		return ret;

	return 0;
}
Beispiel #25
0
static isc_result_t
printsection(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers,
	     dns_section_t section) {
	isc_result_t result, loopresult;
	dns_name_t *name;
	dns_rdataset_t *rdataset = NULL;
	dns_rdata_t rdata = DNS_RDATA_INIT;
	char namebuf[DNS_NAME_FORMATSIZE];

	UNUSED(query);
	UNUSED(headers);

	debug("printsection()");

	result = dns_message_firstname(msg, section);
	if (result == ISC_R_NOMORE)
		return (ISC_R_SUCCESS);
	else if (result != ISC_R_SUCCESS)
		return (result);
	for (;;) {
		name = NULL;
		dns_message_currentname(msg, section,
					&name);
		for (rdataset = ISC_LIST_HEAD(name->list);
		     rdataset != NULL;
		     rdataset = ISC_LIST_NEXT(rdataset, link)) {
			loopresult = dns_rdataset_first(rdataset);
			while (loopresult == ISC_R_SUCCESS) {
				dns_rdataset_current(rdataset, &rdata);
				switch (rdata.type) {
				case dns_rdatatype_a:
					if (section != DNS_SECTION_ANSWER)
						goto def_short_section;
					dns_name_format(name, namebuf,
							sizeof(namebuf));
					printf("Name:\t%s\n", namebuf);
					printa(&rdata);
					break;
				case dns_rdatatype_soa:
					dns_name_format(name, namebuf,
							sizeof(namebuf));
					printf("%s\n", namebuf);
					printsoa(&rdata);
					break;
				default:
				def_short_section:
					dns_name_format(name, namebuf,
							sizeof(namebuf));
					printf("%s\t", namebuf);
					printrdata(&rdata);
					break;
				}
				dns_rdata_reset(&rdata);
				loopresult = dns_rdataset_next(rdataset);
			}
		}
		result = dns_message_nextname(msg, section);
		if (result == ISC_R_NOMORE)
			break;
		else if (result != ISC_R_SUCCESS) {
			return (result);
		}
	}
	return (ISC_R_SUCCESS);
}
Beispiel #26
0
static inline void endp(const int column)
{
	printa(column, "}");
}
Beispiel #27
0
static void gen_type( const act* action, int column)
{

	printa(column, "%ld", action->act_object);
}
Beispiel #28
0
static void gen_s_end( const act* action, int column)
{
	const gpre_req* request = action->act_request;
	printa(column, "EXE_unwind (tdbb, %s);", request->req_handle);
}
Beispiel #29
0
static void make_port( const gpre_port* port, int column)
{
	printa(column, "struct {");

	for (const ref* reference = port->por_references; reference; reference = reference->ref_next)
	{
		align(column + INDENT);
		const gpre_fld* field = reference->ref_field;
		const gpre_sym* symbol = field->fld_symbol;
		const TEXT* name = symbol->sym_string;
		const char* fmtstr = NULL;

		switch (field->fld_dtype)
		{
		case dtype_short:
			fmtstr = "    SSHORT jrd_%d;\t// %s ";
			break;

		case dtype_long:
			fmtstr = "    SLONG  jrd_%d;\t// %s ";
			break;

		// Begin sql date/time/timestamp
		case dtype_sql_date:
			fmtstr = "    ISC_DATE  jrd_%d;\t// %s ";
			break;

		case dtype_sql_time:
			fmtstr = "    ISC_TIME  jrd_%d;\t// %s ";
			break;

		case dtype_timestamp:
			fmtstr = "    ISC_TIMESTAMP  jrd_%d;\t// %s ";
			break;
		// End sql date/time/timestamp

		case dtype_int64:
			fmtstr = "    ISC_INT64  jrd_%d;\t// %s ";
			break;

		case dtype_quad:
			fmtstr = "    ISC_QUAD  jrd_%d;\t// %s ";
			break;

		case dtype_blob:
			fmtstr = "    bid  jrd_%d;\t// %s ";
			break;

		case dtype_cstring:
		case dtype_text:
			fprintf(gpreGlob.out_file, "    TEXT  jrd_%d [%d];\t// %s ",
					reference->ref_ident, field->fld_length, name);
			break;

		case dtype_real:
			fmtstr = "    float  jrd_%d;\t// %s ";
			break;

		case dtype_double:
			fmtstr = "    double  jrd_%d;\t// %s ";
			break;

		case dtype_boolean:
			fmtstr = "    UCHAR  jrd_%d;\t// %s ";
			break;

		default:
			{
				TEXT s[ERROR_LENGTH];
				fb_utils::snprintf(s, sizeof(s), "datatype %d unknown for field %s, msg %d",
						field->fld_dtype, name, port->por_msg_number);
				CPR_error(s);
				return;
			}
		}
		if (fmtstr)
			fprintf(gpreGlob.out_file, fmtstr, reference->ref_ident, name);
	}
	align(column);
	fprintf(gpreGlob.out_file, "} jrd_%"ULONGFORMAT";", port->por_ident);
}
Beispiel #30
0
static inline void begin(const int column)
{
	printa(column, "{");
}