void simulate_RT(component c, double a){
	/* Memory Allocation, Structures and Fields */
	grid_volume v = vol2d(size_x,size_y,a); /* Grid volume for computations */
	structure s0(v,air,pml(h_PML,Y));     /* Reference case: no scatterers; PML termination in the y-direction */
	structure s(v,air_glass_grating,pml(h_PML,Y));	/* Structure to be simulated; PML termination in the y-direction */
	fields f0(&s0); /* Fields for reference case */
	fields f(&s);   /* Fields for simulation structure */
	h5file *eps_file_ptr=f.open_h5file(eps_file_name);
	f.output_hdf5(Dielectric, v.surroundings(), eps_file_ptr, true);    /* Outputting dielectric function as .h5 file; <fields>.output_hdf5(<field_type>,<?>) */

	/* Flux Lines for Transmissions and Reflection Detectors */
	volume flux_line_trans(vec(0,h_PML+4*h_sep+d),vec(size_x,h_PML+4*h_sep+d));
	volume flux_line_refl(vec(0,h_PML+2*h_sep),vec(size_x,h_PML+2*h_sep));

	/* Appropriate Bloch Boundary Conditions */
	double k_x=n_air*freq_centre*sin(theta_degrees*const_pi/180.0);
	f0.use_bloch(vec(k_x,0.0));
	f.use_bloch(vec(k_x,0.0));

	/* Light Sources */
	gaussian_src_time src(freq_centre, 0.5/pw_freq_width, 0, 5/pw_freq_width);      /* Time-domain definition of source */
	volume src_line(vec(0,h_PML+h_sep),vec(size_x,h_PML+h_sep));

	f0.add_volume_source(c,src,src_line,src_spatial_modulator,1.0);
	f.add_volume_source(c,src,src_line,src_spatial_modulator,1.0);
	master_printf("# Line source(s) added ...\n");

	/* Fluxes for Transmission, Reflection */
	dft_flux f_t0 = f0.add_dft_flux_plane(flux_line_trans,min2(freq_min,freq_max),max2(freq_min,freq_max),num_freqs);
	dft_flux f_t = f.add_dft_flux_plane(flux_line_trans,min2(freq_min,freq_max),max2(freq_min,freq_max),num_freqs);
	dft_flux f_r0 = f0.add_dft_flux_plane(flux_line_refl,min2(freq_min,freq_max),max2(freq_min,freq_max),num_freqs);
	dft_flux f_r = f.add_dft_flux_plane(flux_line_refl,min2(freq_min,freq_max),max2(freq_min,freq_max),num_freqs);

	angleResolvedDetectors2D *ard = new angleResolvedDetectors2D(h_PML+4*h_sep, h_PML+2*h_sep, size_x, a, angle_res_degrees, freq_min, freq_max, num_freqs, theta_degrees, n_air, n_air, degree);

	master_printf("# Simulating reference structure ...\n");
	double t_final_src_0=f0.last_source_time(), t_final_sim_0=t_final_src_0+duration_factor*num_freqs/pw_freq_width/2;
	master_printf("\tparameter__user_inaccessible:\tt_final_src_0 = %f\n",t_final_src_0);
	master_printf("\tparameter__user_inaccessible:\tt_final_sim_0 = %f\n",t_final_sim_0);
	while(f0.time() < t_final_sim_0){ /* Time-stepping -- reference structure */
		f0.step(); 
		double t=f0.time();
		ard->update(t,f0,reference);
	}
	f_r0.save_hdf5(f0, flux_file_name, "reflection");
	ard->finalize_update(reference);

	master_printf("# Simulating test structure ...\n");
	double t_final_src=f.last_source_time(), t_final_sim=t_final_src+duration_factor*num_freqs/pw_freq_width/2;
	master_printf("\tparameter__user_inaccessible:\tt_final_src = %f\n",t_final_src);
	master_printf("\tparameter__user_inaccessible:\tt_final_sim = %f\n",t_final_sim);
	f_r.load_hdf5(f, flux_file_name, "reflection");
	f_r.scale_dfts(-1.0);
	while(f.time() < t_final_sim){  /* Time-stepping -- simulated structure */
		f.step();
		double t=f.time();
		ard->update(t,f,simulation);
	}
	f.output_hdf5(c, v.surroundings());     /* Outputting electric field as .h5 file; <fields>.output_hdf5(<field_type>,<?>) */
	ard->finalize_update(simulation);

	double *flux_t = f_t.flux();    /* Calculating flux -- integrating? */
	double *flux_t0 = f_t0.flux();  /* Calculating flux -- integrating? */
	double *flux_r = f_r.flux();    /* Calculating flux -- integrating? */
	double *flux_r0 = f_r0.flux();  /* Calculating flux -- integrating? */

	double *T;      /* Array to store transmission coefficients (frequency-dependent) */
	double *R;      /* Array to store reflection coefficients (frequency-dependent) */
	T = new double[num_freqs];
	R = new double[num_freqs];
	for (int i=0; i<num_freqs; ++i){	/* Calculating transmission, reflection coefficients */
		T[i] = flux_t[i] / flux_t0[i];
		R[i] = -flux_r[i] / flux_r0[i];
	}
	double dfreq = pw_freq_width / (num_freqs-1);

	master_printf("transmission:, omega, T\n");
	master_printf("reflection:, omega, R\n");
	master_printf("addition_check:, omega, R+T\n");
	for (int l=0; l<num_freqs; ++l){	/* Printing transmission coefficient values */
		master_printf("transmission:, %f, %f\n",freq_min+l*dfreq,T[l]);
		master_printf("reflection:, %f, %f\n",freq_min+l*dfreq,R[l]);
		master_printf("addition_check:, %f, %f\n",freq_min+l*dfreq,T[l]+R[l]);
	}

	ard->print_angle_unresolved_T();
	ard->print_angle_unresolved_R();
	ard->print_angle_resolved_T(file_name_prefix);
	ard->print_angle_resolved_R(file_name_prefix);

	delete [] eps_file_name;
	delete [] flux_file_name;


	delete [] flux_t;       /* "Garbage collection" at end of code execution */
	delete [] flux_t0;      /* "Garbage collection" at end of code execution */
	delete [] flux_r;       /* "Garbage collection" at end of code execution */
	delete [] flux_r0;      /* "Garbage collection" at end of code execution */

	delete [] T;    /* "Garbage collection" at end of code execution */
	delete [] R;    /* "Garbage collection" at end of code execution */

	delete ard;
}
示例#2
0
文件: c2z_mem.c 项目: tchandler48/c2z
/* ***************************************************
*  Punch out MEMCPY                                  *
* ************************************************** */
void c2_memcpy(void) 
{
  if (traceflg == 1) 
  {
    strcpy(trace_1, "c2z_mem.c c2_memcpy");
    trace_rec_1();
  }

  char ch;
  char *p1;
  char tfield1[VAR_LGTH];
  char tfield2[VAR_LGTH];
  char tfield3[VAR_LGTH];

  int pi;
  int pi2;
  int x = 0;
  int x1 = 0;
  int x4 = 0;
  int I = 0;
  int ret = 0;

  p1 = strstr(p_string, "+");

  pi = 0;
  ch = p_string[pi];
  while ((ch == ' ') || (ch == '\t') || (ch == '{')) 
  {
    pi++;
    ch = p_string[pi];
  }

  while (ch != '(') 
  {
    pi++;
    ch = p_string[pi];
  }

  pi++;
  ch = p_string[pi];
  pi2 = 0;
  while (ch != ',') 
  {
    tfield1[pi2] = ch;
    pi2++;
    pi++;
    ch = p_string[pi];
  }
  tfield1[pi2] = '\0';

  x = 0;
  for (I = 0; I < gv_ct; I++) 
  {
    ret = strcmp(tfield1, gw_variable[I].gv_name);
    if (ret == 0) 
    {
      x4 = gw_variable[I].gv_lgth;
      x1 = strcmp(gw_variable[I].gv_type, "C");
      if (x1 != 0) 
      {
        printf("c2z_mem.c c2_memcpy tfield1 Not Character = %s\n", tfield1);
        printf("c2z_mem.c c2_memcpy rct = %d p_string = %s", rct, p_string);
        c2_debug();
        exit(1);
      }
      if (x1 == 0)
      {
        x = 1;
      }
    }
  }

  if (x == 0) 
  {
    printf("c2z_mem.c c2_memcpy tfield1 Not Found = %s\n", tfield1);
    printf("c2z_mem.c c2_memcpy rct = %d p_string = %s", rct, p_string);
    c2_debug();
    exit(1);
  }

  if (!p1) 
  {
    while (ch != ',') 
    {
      pi++;
      ch = p_string[pi];
    }

    pi++;
    ch = p_string[pi];
    pi2 = 0;
    while (ch != ',') 
    {
      tfield2[pi2] = ch;
      pi2++;
      pi++;
      ch = p_string[pi];
    }
    tfield2[pi2] = '\0';

    while (ch != ',') 
    {
      pi++;
      ch = p_string[pi];
    }

    pi++;
    ch = p_string[pi];
    pi2 = 0;
    while (ch != ')') 
    {

      tfield3[pi2] = ch;
      pi2++;
      pi++;
      ch = p_string[pi];
    }
    tfield3[pi2] = '\0';

    strcpy(a_string, "*");
    src_line();
    if (puncde == 1) 
    {
      strcpy(trace_1, "c2z_mem.c c2_memcpy #1");
      trace_rec_3();
    }

    strcpy(a_string, "         MVC   ");
    strcat(a_string, tfield1);
    strcat(a_string, "(");
    snprintf(wk_strg, sizeof(wk_strg), "%d", x4);
    strcat(a_string, wk_strg);
    strcat(a_string, "),=CL");
    strcat(a_string, wk_strg);
    strcat(a_string, "' '");
    strcpy(wk_remark, " memcpy   */");
    write_remark();
    if (puncde == 1) 
    {
      strcpy(trace_1, "c2z_mem.c c2_memcpy #2");
      trace_rec_3();
    }

    strcpy(a_string, "         MVC   ");
    strcat(a_string, tfield1);
    strcat(a_string, "(");
    strcat(a_string, tfield3);
    strcat(a_string, "),");
    strcat(a_string, tfield2);
    src_line();
    if (puncde == 1) 
    {
      strcpy(trace_1, "c2z_mem.c c2_memcpy #3");
      trace_rec_3();
    }

    strcpy(a_string, "*");
    src_line();
    if (puncde == 1) 
    {
      strcpy(trace_1, "c2z_mem.c c2_memcpy #4");
      trace_rec_3();
    }
  }

  if (p1) 
  {
    pi = 0;
    ch = p_string[pi];
    while ((ch == ' ') || (ch == '\t') || (ch == '{')) 
    {
      pi++;
      ch = p_string[pi];
    }

    while (ch != '(') 
    {
      pi++;
      ch = p_string[pi];
    }

    pi++;
    ch = p_string[pi];
    pi2 = 0;
    while (ch != ',') 
    {
      if (ch != '_') 
      {
        tfield1[pi2] = ch;
        pi2++;
      }
      pi++;
      ch = p_string[pi];
    }
    tfield1[pi2] = '\0';

    x = 0;
    x4 = 0;
    for (I = 0; I < gv_ct; I++) 
    {
      ret = strcmp(tfield1, gw_variable[I].gv_name);
      if (ret == 0)
      {
        x4 = gw_variable[I].gv_lgth;
        x1 = strcmp(gw_variable[I].gv_type, "C");
        if (x1 != 0) 
        {
          printf("c2z_mem.c c2_memcpy tfield1 Not Character = %s\n", tfield1);
          printf("c2z_mem.c c2_memcpy rct = %d p_string = %s", rct, p_string);
          c2_debug();
          exit(1);
        }
        if (x1 == 0)
        {
          x = 1;
        }
      }
    }

    if (x == 0) 
    {
      printf("c2z_mem.c c2_memcpy tfield1 Not Found = %s\n", tfield1);
      printf("c2z_mem.c c2_memcpy rct = %d p_string = %s", rct, p_string);
      c2_debug();
      exit(1);
    }

    while (ch != ',') 
    {
      pi++;
      ch = p_string[pi];
    }

    pi++;
    ch = p_string[pi];
    pi2 = 0;
    while (ch != ',') 
    {
      if (ch != '_') 
      {
        tfield2[pi2] = ch;
        pi2++;
      }
      pi++;
      ch = p_string[pi];
    }
    tfield2[pi2] = '\0';

    while (ch != ',') 
    {
      pi++;
      ch = p_string[pi];
    }

    pi++;
    ch = p_string[pi];
    pi2 = 0;
    while (ch != ')') 
    {
      tfield3[pi2] = ch;
      pi2++;
      pi++;
      ch = p_string[pi];
    }
    tfield3[pi2] = '\0';

    strcpy(a_string, "*");
    src_line();
    if (puncde == 1) 
    {
      strcpy(trace_1, "c2z_mem.c c2_memcpy #5");
      trace_rec_3();
    }

    strcpy(a_string, "         MVC   ");
    strcat(a_string, tfield1);
    strcat(a_string, "(");
    snprintf(wk_strg, sizeof(wk_strg), "%d", x4);
    strcat(a_string, wk_strg);
    strcat(a_string, "),=CL");
    strcat(a_string, wk_strg);
    strcat(a_string, "' '");
    strcat(a_string, "' '");
    strcpy(wk_remark, " memcpy   */");
    write_remark();
    if (puncde == 1) 
    {
      strcpy(trace_1, "c2z_mem.c c2_memcpy #6");
      trace_rec_3();
    }

    strcpy(a_string, "         MVC   ");
    strcat(a_string, tfield1);
    strcat(a_string, "(");
    strcat(a_string, tfield3);
    strcat(a_string, "),");
    strcat(a_string, tfield2);
    src_line();
    if (puncde == 1) 
    {
      strcpy(trace_1, "c2z_mem.c c2_memcpy #7");
      trace_rec_3();
    }

    strcpy(a_string, "*");
    src_line();
    if (puncde == 1) 
    {
      strcpy(trace_1, "c2z_mem.c c2_memcpy #8");
      trace_rec_3();
    }
  }
}
示例#3
0
void c2_isalnum() 
{
  strcpy(a_string, "*");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #1");
    trace_rec_3();
  }

  strcpy(a_string, "ISALNUM  DS    0H");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #2");
    trace_rec_3();
  }

  strcpy(a_string, "         LARL  R9,C370L1");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #5");
    trace_rec_3();
  }

  strcpy(a_string, "         LARL  R8,C370EOF");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #6");
    trace_rec_3();
  }
  work_use_ct[74]++;

  strcpy(a_string, "         CLC   0(1,R9),0(R8)");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #7");
    trace_rec_3();
  }

  strcpy(a_string, "         JLE   ALN06");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #8");
    trace_rec_3();
  }

  strcpy(a_string, "         LARL  R9,C370L1");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #5");
    trace_rec_3();
  }

  strcpy(a_string, "         LARL  R8,C370XXX");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #6");
    trace_rec_3();
  }
  work_use_ct[72]++;

  strcpy(a_string, "         CLC   0(1,R9),0(R8)");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #7");
    trace_rec_3();
  }

  strcpy(a_string, "         JLE   ALN06");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #8");
    trace_rec_3();
  }

  strcpy(a_string, "         LARL  R9,C370L1");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #9");
    trace_rec_3();
  }

  strcpy(a_string, "         LARL  R8,C370B1");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #10");
    trace_rec_3();
  }
  work_use_ct[52]++;

  strcpy(a_string, "         CLC   0(1,R9),0(R8)");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #11");
    trace_rec_3();
  }

  strcpy(a_string, "         JLE   ALN06");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #12");
    trace_rec_3();
  }

  strcpy(a_string, "         LARL  R9,C370L1");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #13");
    trace_rec_3();
  }

  strcpy(a_string, "         LARL  R8,C370PER");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #14");
    trace_rec_3();
  }
  work_use_ct[75]++;

  strcpy(a_string, "         CLC   0(1,R9),0(R8)");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #15");
    trace_rec_3();
  }

  strcpy(a_string, "         JLE   ALN06");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #16");
    trace_rec_3();
  }

  strcpy(a_string, "         LARL  R9,C370L1");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #17");
    trace_rec_3();
  }

  strcpy(a_string, "         LARL  R8,C370COLN");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #18");
    trace_rec_3();
  }
  work_use_ct[81]++;

  strcpy(a_string, "         CLC   0(1,R9),0(R8)");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #19");
    trace_rec_3();
  }

  strcpy(a_string, "         JLE   ALN06");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #20");
    trace_rec_3();
  }

  strcpy(a_string, "         LARL  R9,C370L1A");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #21");
    trace_rec_3();
  }
  work_use_ct[59]++;

  strcpy(a_string, "         LARL  R8,C370UCA");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #22");
    trace_rec_3();
  }
  work_use_ct[35]++;

  strcpy(a_string, "         MVC   0(1,R9),0(R8)");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #23");
    trace_rec_3();
  }
  work_use_ct[59]++;

  strcpy(a_string, "         LARL  R9,C370L1");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #24");
    trace_rec_3();
  }
  work_use_ct[2]++;

  strcpy(a_string, "         LARL  R8,C370L1A");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #25");
    trace_rec_3();
  }
  work_use_ct[59]++;

  strcpy(a_string, "         CLC   0(1,R9),0(R8)");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #26");
    trace_rec_3();
  }
  work_use_ct[59]++;

  strcpy(a_string, "         JLE   ALN01");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #27");
    trace_rec_3();
  }

  strcpy(a_string, "         JLH   ALN01");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #28");
    trace_rec_3();
  }

  strcpy(a_string, "         JLU   ALN02");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #29");
    trace_rec_3();
  }

  strcpy(a_string, "ALN01    DS    0H");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #30");
    trace_rec_3();
  }

  strcpy(a_string, "         LARL  R9,C370L1A");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #31");
    trace_rec_3();
  }
  work_use_ct[59]++;

  strcpy(a_string, "         LARL  R8,C370UCZ");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #32");
    trace_rec_3();
  }
  work_use_ct[36]++;

  strcpy(a_string, "         MVC   0(1,R9),0(R8)");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #33");
    trace_rec_3();
  }
  work_use_ct[59]++;

  strcpy(a_string, "         LARL  R9,C370L1");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #34");
    trace_rec_3();
  }
  work_use_ct[2]++;

  strcpy(a_string, "         LARL  R9,C370L1A");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #35");
    trace_rec_3();
  }
  work_use_ct[59]++;

  strcpy(a_string, "         CLC   0(1,R9),0(R8)");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #36");
    trace_rec_3();
  }
  work_use_ct[59]++;

  strcpy(a_string, "         JLE   ALN03");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #37");
    trace_rec_3();
  }

  strcpy(a_string, "         JLL   ALN03");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #38");
    trace_rec_3();
  }

  strcpy(a_string, "         JLU   ALN02");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #39");
    trace_rec_3();
  }

  strcpy(a_string, "ALN03    DS    0H");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #40");
    trace_rec_3();
  }

  strcpy(a_string, "         LARL  R9,C370ISAL");
  strcpy(wk_remark, " C370ISAL */");
  write_remark();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #41");
    trace_rec_3();
  }

  strcpy(a_string, "         LARL  R8,C370ONE");
  strcpy(wk_remark, " C370ONE */");
  write_remark();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #42");
    trace_rec_3();
  }
  work_use_ct[33]++;

  strcpy(a_string, "         ZAP   0(6,R9),0(6,R8)");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #43");
    trace_rec_3();
  }

  strcpy(a_string, "         JLU   ALN04");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #44");
    trace_rec_3();
  }

  strcpy(a_string, "ALN02    DS    0H");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #45");
    trace_rec_3();
  }

  strcpy(a_string, "         LARL  R9,C370L1A");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #46");
    trace_rec_3();
  }
  work_use_ct[59]++;

  strcpy(a_string, "         LARL  R8,C370LCA");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #47");
    trace_rec_3();
  }
  work_use_ct[37]++;

  strcpy(a_string, "         MVC   0(1,R9),0(R8)");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #48");
    trace_rec_3();
  }
  work_use_ct[59]++;

  strcpy(a_string, "         LARL  R9,C370L1");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #49");
    trace_rec_3();
  }
  work_use_ct[2]++;

  strcpy(a_string, "         LARL  R9,C370L1A");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #50");
    trace_rec_3();
  }
  work_use_ct[59]++;

  strcpy(a_string, "         CLC   0(1,R9),0(R8)");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #51");
    trace_rec_3();
  }
  work_use_ct[59]++;

  strcpy(a_string, "         JLE   ALN05");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #52");
    trace_rec_3();
  }

  strcpy(a_string, "         JLH   ALN05");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #53");
    trace_rec_3();
  }

  strcpy(a_string, "         JLU   ALN06");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #54");
    trace_rec_3();
  }

  strcpy(a_string, "ALN05    DS    0H");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #55");
    trace_rec_3();
  }

  strcpy(a_string, "         LARL  R9,C370L1A");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #56");
    trace_rec_3();
  }
  work_use_ct[59]++;

  strcpy(a_string, "         LARL  R8,C370LCZ");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #57");
    trace_rec_3();
  }
  work_use_ct[38]++;

  strcpy(a_string, "         MVC   0(1,R9),0(R8)");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #58");
    trace_rec_3();
  }
  work_use_ct[59]++;

  strcpy(a_string, "         LARL  R9,C370L1");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #59");
    trace_rec_3();
  }
  work_use_ct[2]++;

  strcpy(a_string, "         LARL  R9,C370L1A");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #60");
    trace_rec_3();
  }
  work_use_ct[59]++;

  strcpy(a_string, "         CLC   0(1,R9),0(R8)");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #61");
    trace_rec_3();
  }
  work_use_ct[59]++;

  strcpy(a_string, "         JLE   ALN03");
  src_line();
  if (puncde == 1)
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #62");
    trace_rec_3();
  }

  strcpy(a_string, "         JLL   ALN03");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #63");
    trace_rec_3();
  }

  strcpy(a_string, "ALN06    DS    0H");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #64");
    trace_rec_3();
  }

  strcpy(a_string, "         LARL  R9,C370ISAL");
  strcpy(wk_remark, " C370ISAL */");
  write_remark();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #65");
    trace_rec_3();
  }

  strcpy(a_string, "         LARL  R8,C370ZERO");
  strcpy(wk_remark, " C370ZERO */");
  write_remark();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #66");
    trace_rec_3();
  }
  work_use_ct[32]++;

  strcpy(a_string, "         ZAP   0(6,R9),0(6,R8)");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #67");
    trace_rec_3();
  }

  strcpy(a_string, "ALN04    DS    0H");
  src_line();
  if (puncde == 1)
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #68");
    trace_rec_3();
  }

  strcpy(a_string, "         PR");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_isalnum.c c2_isalnum #71");
    trace_rec_3();
  }
}
示例#4
0
/* ***************************************************
*  Punch ++ statement                                *
* ************************************************** */
void c2_plus() 
{
  if (traceflg == 1) 
  {
    strcpy(trace_1, "c2z.incr.c c2_plus #1 START");
    trace_rec_1();
  }

  char *p, *p1, *p2, *p3;
  char ch;
  char field1[VAR_LGTH];
  char field1a[VAR_LGTH];
  char field2[VAR_LGTH];
  char field2a[VAR_LGTH];
  char field6[VAR_LGTH];
  char field7[VAR_LGTH];

  char tfield1[VAR_LGTH];
  char tfield5[VAR_LGTH];
  char tfield6[VAR_LGTH];
  char tfield7[VAR_LGTH];
  char tfield8[VAR_LGTH];
  char tfield9[VAR_LGTH];
  char tfield10[VAR_LGTH];
  char tfield11[VAR_LGTH];

  int pi;
  int pi2;
  int pl1 = 0;
  int pl3 = 0;
  int I = 0;
  int x2 = 0;
  int fd2_type = 0;
  int ret = 0;
  int ret1 = 0;

  p = strstr(p_string, "++");
  p1 = strstr(p_string, "printf");
  p2 = strstr(p_string, "[");
  p3 = strstr(p_string, "]");
  if ((p) && (!p1) && (!p2) && (!p3)) 
  {
    pi = 0;
    ch = p_string[pi];
    while ((ch == ' ') || (ch == '\t') || (ch == '{')) 
    {
      pi++;
      ch = p_string[pi];
    }

    pi2 = 0;
    ch = p_string[pi];
    while (ch != '+') 
    {
      if(ch != ' ')
      {
        field1[pi2] = ch;
        pi2++;
      }
      pi++;
      ch = p_string[pi];
    }
    field1[pi2] = '\0';

    pl1 = 0;
    pl3 = 0;
    if (lv_ct > 0) 
    {
      for (I = 0; I < lv_ct; I++) 
      {
        ret = strcmp(field1, lw_variable[I].lv_name);
        ret1 = strcmp(sv_func, lw_variable[I].lv_func);
        if ((ret == 0) && (ret1 == 0)) 
        {
          pl1 = 1;
          strcpy(field1a, lw_variable[I].lv_cname);
          lw_variable[I].lv_use_ct++;
          lw_variable[I].lv_current_lgth++;
        }
      }
    }

    if (pl1 == 0) 
    {
      if (gv_ct > 0) 
      {
        for (I = 0; I < gv_ct; I++) 
        {
          pl3 = strcmp(field1, gw_variable[I].gv_name);
          if (pl3 == 0) 
          {
            pl1 = 1;
            strcpy(field1a, gw_variable[I].gv_cname);
            gw_variable[I].gv_use_ct++;
            gw_variable[I].gv_current_lgth++;
          }
        }
      }
    }

    if (pl1 == 0) 
    {
      printf("c2z_incr.c c2_plus E-294 field1 Not Found = %s sv_func = %s\n", field1,sv_func);
      printf("c2z_incr.c c2_plus rct = %d p_string = %s", rct, p_string);
      c2_debug();
      exit(1);
    }

    strcpy(a_string, "         LARL  R9,");
    strcat(a_string, field1a);
    strcpy(wk_remark, " ");
    strcat(wk_remark, field1);
    strcat(wk_remark, " */");
    write_remark();
    if (puncde == 1) 
    {
      strcpy(trace_1, "c2z_incr.c c2_plus #1");
      trace_rec_3();
    }

    strcpy(a_string, "         LARL  R8,C370ONE");
    strcpy(wk_remark, " C370ONE */");
    write_remark();
    if (puncde == 1) 
    {
      strcpy(trace_1, "c2z_incr.c c2_plus #2");
      trace_rec_3();
    }
    work_use_ct[33]++;

    strcpy(a_string, "         AP    0(6,R9),0(6,R8)");
    strcpy(wk_remark, " ++       */ ");
    write_remark();
    if (puncde == 1) 
    {
      strcpy(trace_1, "c2z_incr.c c2_plus #3");
      trace_rec_3();
    }
    convert = 1;
    return;
  }

  if ((p) && (!p1) && (p2) && (p3)) /*  int array[x]++;	*/
  {
    pi = 0;
    ch = p_string[pi];
    while ((ch == ' ') || (ch == '\t') || (ch == '{')) 
    {
      pi++;
      ch = p_string[pi];
    }

    pi2 = 0;
    ch = p_string[pi];
    while (ch != '[') 
    {
      if(ch != ' ')
      {
        tfield1[pi2] = ch;
        pi2++;
      }
      pi++;
      ch = p_string[pi];
    }
    tfield1[pi2] = '\0';

    pi++;
    ch = p_string[pi];
    while (ch != ']') 
    {
      pi++;
      ch = p_string[pi];
    }

    x2 = 0;
    fd2_type = 0;
    pi++;
    pi2 = 0;
    ch = p_string[pi];
    while (ch != ']') 
    {
      if (x2 == 0) 
      {
        if ((isdigit(ch)) && (x2 == 0)) 
        {
          fd2_type = 2;
          x2 = 1;
        }
        if ((isalpha(ch)) && (x2 == 0)) 
        {
          fd2_type = 1;
          x2 = 1;
        }
      }
      pi2++;
      pi++;
      ch = p_string[pi];
    }

    if (gv_ct > 0) 
    {
      for (I = 0; I < gv_ct; I++) 
      {
        ret = strcmp(tfield1, gw_variable[I].gv_name);
        if (ret == 0) 
        {
          strcpy(tfield5, gw_variable[I].gv_dsect);
          strcpy(tfield6, gw_variable[I].gv_label);
          strcpy(tfield7, gw_variable[I].gv_table);
          strcpy(tfield8, gw_variable[I].gv_aname);
          strcpy(tfield9, gw_variable[I].gv_sv_reg);
          strcpy(tfield10, gw_variable[I].gv_wk_reg);
          strcpy(tfield11, gw_variable[I].gv_wk_strg);
        }
      }
    }

    strcpy(a_string, "         LARL  R9,C370NWK1");
    src_line();
    if (puncde == 1) 
    {
      strcpy(trace_1, "c2z_incr_c c2_plus_array #1");
      trace_rec_3();
    }
    work_use_ct[49]++;

    strcpy(a_string, "         LARL  R8,C370ZERO");
    src_line();
    if (puncde == 1) 
    {
      strcpy(trace_1, "c2z_incr.c c2_plus_array #2");
      trace_rec_3();
    }
    work_use_ct[32]++;

    strcpy(a_string, "         ZAP   0(6,R9),0(6,R8)");
    src_line();
    if (puncde == 1) 
    {
      strcpy(trace_1, "c2z_incr.c c2_plus_array #3");
      trace_rec_3();
    }

    strcpy(a_string, "         LARL  R6,");
    strcat(a_string, field7);
    src_line();
    if (puncde == 1) 
    {
      strcpy(trace_1, "c2z_incr.c c2_plus_array #4");
      trace_rec_3();
    }

    strcpy(a_string, "L");
    snprintf(wk_strg, sizeof(wk_strg), "%d", rct);
    strcat(a_string, wk_strg);
    strcat(a_string, "G");
    check_length();
    strcat(a_string, "DS    0H");
    src_line();
    if (puncde == 1) 
    {
      strcpy(trace_1, "c2z_incr.c c2_plus_array #5");
      trace_rec_3();
    }

    strcpy(a_string, "         LARL  R9,C370NWK1");
    src_line();
    if (puncde == 1) 
    {
      strcpy(trace_1, "c2z_incr.c c2_plus_array #6");
      trace_rec_3();
    }
    work_use_ct[49]++;

    if (fd2_type == 2) 			/* literal  */
    {
/*
      for (v = 0; v < math_lit_ct; v++) 
      {
        if ((rct == w_mathlit[v].lit_rct) && (w_mathlit[v].lit_uct == 1)) 
        {
          strcpy(a_string, "         LARL  R8,");
          strcat(a_string, w_mathlit[v].lit_use_cname);
          break;
        }
      }
      src_line();
      if (puncde == 1) 
      {
        strcpy(trace_1, "c2z_incr.c c2_plus_array #7");
        trace_rec_3();
      }
*/

printf("FIX FIX FIX c2_plus_array #7\n");
printf("rct = %d p_string = %s",rct,p_string);

    }

    if (fd2_type == 1) 			/* variable */
    {
      strcpy(a_string, "         LARL  R8,");
      strcat(a_string, field2a);
      strcpy(wk_remark, " ");
      strcat(wk_remark, field2);
      strcat(wk_remark, " */");
      write_remark();
      if (puncde == 1) 
      {
        strcpy(trace_1, "c2z_incr.c c2_plus_array #8");
        trace_rec_3();
      }
    }

    strcpy(a_string, "         CP    0(6,R9),0(6,R8)");
    src_line();
    if (puncde == 1) 
    {
      strcpy(trace_1, "c2z_incr.c c2_plus_array #8");
      trace_rec_3();
    }

    strcpy(a_string, "         JLE   ");
    strcat(a_string, "L");
    snprintf(wk_strg, sizeof(wk_strg), "%d", rct);
    strcat(a_string, wk_strg);
    strcat(a_string, "F");
    src_line();
    if (puncde == 1) 
    {
      strcpy(trace_1, "c2z_incr.c c2_plus_array #9");
      trace_rec_3();
    }

    strcpy(a_string, "         LARL  R9,C370NWK1");
    src_line();
    if (puncde == 1) 
    {
      strcpy(trace_1, "c2z_incr.c c2_plus_array #10");
      trace_rec_3();
    }
    work_use_ct[49]++;

    strcpy(a_string, "         LARL  R8,C370ONE");
    src_line();
    if (puncde == 1) 
    {
      strcpy(trace_1, "c2z_incr.c c2_plus_array #11");
      trace_rec_3();
    }
    work_use_ct[32]++;

    strcpy(a_string, "         AP    0(6,R9),0(6,R8)");
    src_line();
    if (puncde == 1) 
    {
      strcpy(trace_1, "c2z_incr.c c2_plus_array #12");
      trace_rec_3();
    }

    strcpy(a_string, "         LA    R6,");
    strcat(a_string, field6);
    strcat(a_string, "(R0,R6)");
    src_line();
    if (puncde == 1) 
    {
      strcpy(trace_1, "c2z_incr.c c2_plus_array #13");
      trace_rec_3();
    }

    strcpy(a_string, "         JLU   ");
    strcat(a_string, "L");
    snprintf(wk_strg, sizeof(wk_strg), "%d", rct);
    strcat(a_string, wk_strg);
    strcat(a_string, "G");
    src_line();
    if (puncde == 1) 
    {
      strcpy(trace_1, "c2z_incr.c c2_plus_array #14");
      trace_rec_3();
    }

    strcpy(a_string, "L");
    snprintf(wk_strg, sizeof(wk_strg), "%d", rct);
    strcat(a_string, wk_strg);
    strcat(a_string, "F");
    check_length();
    strcat(a_string, "DS    0H");
    src_line();
    if (puncde == 1) 
    {
      strcpy(trace_1, "c2z_incr.c c2_plus_array #15");
      trace_rec_3();
    }

    strcpy(a_string, "         LARL  R9,C370ONE");
    src_line();
    if (puncde == 1) 
    {
      strcpy(trace_1, "c2z_incr.c c2_plus_array #16");
      trace_rec_3();
    }
    work_use_ct[49]++;

    strcpy(a_string, "         AP    0(6,R6),0(6,R9)");
    src_line();
    if (puncde == 1) 
    {
      strcpy(trace_1, "c2z_incr.c c2_plus_array #17");
      trace_rec_3();
    }
    convert = 1;
    return;
  }
}
示例#5
0
/* ***************************************************
*  Punch out STRSET                                  *
* ************************************************** */
void c2_strset(void) 
{
  if (traceflg == 1) 
  {
    strcpy(trace_1, "c2z_strset.c c2_strset");
    trace_rec_1();
  }

  char ch;
  char field1[VAR_LGTH];
  char field2[VAR_LGTH];

  int pi;
  int pi2;
  int x = 0;
  int x1 = 0;
  int x3 = 0;
  int I = 0;
  int ret = 0;

  pi = 0;
  ch = p_string[pi];
  while ((ch == ' ') || (ch == '\t')) 
  {
    pi++;
    ch = p_string[pi];
  }

  while (ch != '(') 
  {
    pi++;
    ch = p_string[pi];
  }

  pi++;
  ch = p_string[pi];
  pi2 = 0;
  while (ch != ',') 
  {
    field1[pi2] = ch;
    pi2++;
    pi++;
    ch = p_string[pi];
  }
  field1[pi2] = '\0';

  x = 0;
  for (I = 0; I < gv_ct; I++) 
  {
    ret = strcmp(field1, gw_variable[I].gv_name);
    if (ret == 0) 
    {
      x1 = strcmp(gw_variable[I].gv_type, "C");
      if (x1 != 0) 
      {
        printf("c2z_strset.c c2_strset E-513 field1 Not Character = %s\n",field1);
        c2_error();
      }
      if (x1 == 0)
      {
        x = 1;
      }
    }
  }

  if (x == 0) 
  {
    printf("c2z_strset.c c2_strset E-514 field1 Not Found = %s\n", field1);
    c2_error();
  }

  while (ch != ',') 
  {
    pi++;
    ch = p_string[pi];
  }

  pi++;
  ch = p_string[pi];
  while (ch == ' ') 
  {
    pi++;
    ch = p_string[pi];
  }

  pi2 = 0;
  while (ch != ')') 
  {
    if (ch != '\'') 
    {
      field2[pi2] = ch;
      pi2++;
    }
    pi++;
    ch = p_string[pi];
  }
  field2[pi2] = '\0';

  for (I = 0; I < gv_ct; I++) 
  {
    ret = strcmp(gw_variable[I].gv_name, field1);
    if (ret == 0) 
    {
      x3 = gw_variable[I].gv_lgth;
    }
  }

  x3--;
  strcpy(a_string, "         MVI   ");
  strcat(a_string, field1);
  strcat(a_string, ",C'");
  strcat(a_string, field2);
  strcat(a_string, "'");
  strcpy(wk_remark, " strset  */");
  write_remark();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_strset.c c2_strset #1");
    trace_rec_3();
  }

  strcpy(a_string, "         MVC   ");
  strcat(a_string, field1);
  strcat(a_string, "+1(");
  snprintf(wk_strg, sizeof(wk_strg), "%d", x3);
  strcat(a_string, wk_strg);
  strcat(a_string, "),");
  strcat(a_string, field1);
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_strset.c c2_strset #2");
    trace_rec_3();
  }

  strcpy(a_string, "*");
  src_line();
  if (puncde == 1) 
  {
    strcpy(trace_1, "c2z_strset.c c2_strset #3");
    trace_rec_3();
  }
}