Пример #1
0
void DrawWindowContent() {
  int w = nWWidth;
  int h = nWHeight;

  WSetColor(DARKGRAY);
  WFillRectangle(0, 0, w, h);
  WSetColor(BLACK);
  // axis
  WDrawLine(0, h / 2, w, h / 2);
  WDrawLine(w / 2, 0, w / 2, h);
  // arrows
  WDrawLine(w / 2, 0, w / 2 - 5, 5);
  WDrawLine(w / 2, 0, w / 2 + 5, 5);

  WDrawLine(w, h / 2, w - 5, h / 2 - 5);
  WDrawLine(w, h / 2, w - 5, h / 2 + 5);
  WDrawString("Press Q to quit, F1...F4 to change function", 10, 20);

  WSetColor(GREEN);
  for (int i = 0; i < N; i++)
    WDrawLine(MX(x[i]), MY(f(x[i])), MX(x[i + 1]), MY(f(x[i + 1])));
  WSetColor(BLUE);
  double stp = 0.0001;
  for (double x = a; x < b; x += stp)
    WDrawLine(MX(x), MY(f(x)), MX(x + stp), MY(f(x + stp)));
  //    WSetColor (RED);
  //    for (double x = a; x < b; x+=stp)
  //	WDrawLine(MX(x), MY(F(x)), MX(x+stp), MY(F(x+stp)));
}
Пример #2
0
		_U32 CMysqlDBApi::CreateAvatar(_U32 user_id, _U32 avatar_scope, const char* avatar_name, const char* avatar_desc)
		{
			String sql = StringFormat("INSERT INTO avatar_table(user_id, avatar_scope, avatar_name, avatar_desc) VALUES(%u, %u, '%s', '%s')",
				user_id, avatar_scope, MY(avatar_name), MY(avatar_desc));
			if(mysql_real_query(m_mysql, sql.c_str(), (unsigned long)sql.size())!=0)
			{
				printf("error in mysql_real_query(%d), %s", mysql_errno(m_mysql), mysql_error(m_mysql));
				return (_U32)-1;
			}
			return (_U32)mysql_insert_id(m_mysql);
		}
Пример #3
0
void DrawWindowContent() {
  int w = nWWidth;
  int h = nWHeight;

  WSetColor(DARKGRAY);
  WFillRectangle(0, 0, w, h);
  WSetColor(BLACK);
  // axis
  WDrawLine(0, h / 2, w, h / 2);
  WDrawLine(w / 2, 0, w / 2, h);
  // arrows
  WDrawLine(w / 2, 0, w / 2 - 5, 5);
  WDrawLine(w / 2, 0, w / 2 + 5, 5);

  WDrawLine(w, h / 2, w - 5, h / 2 - 5);
  WDrawLine(w, h / 2, w - 5, h / 2 + 5);
  WSetColor(RED);
  WDrawString("Q=quit, F1..F4 -- change scale, F5/F6 -- change node count", 10,
              20);

  double diff = 0;
  for (int i = 1; i <= N - 1; i++) {

    int k = i;
    if (i == 1)
      k = 2;
    if (i == N - 1)
      k = N - 2; // edge conditions

    int ss = int((X(i) - a) / (b - a) * w);
    int se = int((X(i + 1) - a) / (b - a) * w);

    for (int j = ss; j <= se; j++) {
      double t1 = (double(j) / double(w)) * (b - a) + a;
      double t2 = (double(j + 1) / double(w)) * (b - a) + a;
      WSetColor(GREEN);

      WDrawLine(MX(t1), MY(Par(k, t1)), MX(t2), MY(Par(k, t2)));
      WSetColor(BLUE);
      WDrawLine(MX(t1), MY(f(t1)), MX(t2), MY(f(t2)));
      if (diff < fabs(f(t1) - Par(k, t1)))
        diff = fabs(f(t1) - Par(k, t1));
    }
  }
  WSetColor(RED);
  for (int i = 1; i <= N; i++)
    WDrawLine(MX(X(i)), h / 2 - 3, MX(X(i)), h / 2 + 3);

  char str[256];
  WSetColor(RED);
  sprintf(str, "Difference: %1.20lf", diff);
  WDrawString(str, 10, 40);
}
Пример #4
0
int main()
{
      //******交友系统友善界面******//
      system("color 0e");
      int b,flag = 0; 
      struct student *head;
      head = (struct student*)malloc(sizeof(struct student));
      head -> next = NULL;
      time_t now;
      now = time (NULL);
     while(1) 
     {
           printf("\n\t\t\t   欢迎来到郑州大学学生交友系统\n");
           printf("\n\t\t\t编制人员  :郑大四班孙朝\n\n");
           printf("\t\t\t  -----------------------------\n\n"); 
           printf("\t\t1.注册学生的信息");
	       printf("\t\t2.查询学生信息\n\n"); 
      	   printf("\t\t3.按男女学生分类");
   		   printf("\t\t4.管理员权限\n\n"); 
   		   printf("\t\t5.我的个人信息");
   		   printf("\t\t\t6.保存十二星座\n\n");
   		   printf("\t\t7.星座速配");
   		   printf("\t\t\t8.列举单身学生信息\n\n");
		   printf("\t\t9.音乐播放")	;    
   		   printf("\t\t\t0.退出\n\n"); 
   		   printf("\t\t\t>>>>>>请输入你的选择:\n\n");
   		   printf("\t\t    made by sz,now time is %s\n",ctime(&now));
   		   printf("\t\t-----------------------------------------------------\n\n");
   		   scanf("%d",&b);
   		   switch(b)
   		  {
            case 1: input();
            break;
            case 2:search(head);
            break;
            case 3:seek(head);
            break;
            case 4:administrate(head);
            break;
            case 5:MY();
            break;
            case 6:inputcons();
            break;
            case 7:cons();
            break;
            case 8:singlesearch(head);
            break;
            case 9:system("d:\\567.mp3");
            break;	
            case 0:exit(0);
            break;     
            default:
                printf("错误!");   
                break;     
          }
     }
     system("d:\\567.mp3");
     system("pause");
     return 0;
} 
Пример #5
0
//calculate M and B
static inline void calcMB()
{
  //todo code of EZ(i, j+1) and EZ(i,j) may be reverse ? 
  for(int i=1; i<N_PX-1; i++){
    for(int j=1; j<N_PY-1; j++){
      double complex nowMx = MX(i,j);
      Mx[ind(i,j)] = CMX(i,j)*MX(i,j) - CMXEZ(i,j)*(EZ(i,j+1) - EZ(i,j));
      Bx[ind(i,j)] = CBX(i,j)*BX(i,j) + CBXMX1(i,j)*MX(i,j) - CBXMX0(i,j)*nowMx;
    }
  }
  
  //todo code of EZ(i+1, j) and EZ(i,j)
  for(int i=1; i<N_PX-1; i++){
    for(int j=1; j<N_PY-1; j++){
      double complex nowMy = MY(i,j);
      My[ind(i,j)] = CMY(i,j)*MY(i,j) - CMYEZ(i,j)*(-EZ(i+1,j) + EZ(i,j));
      By[ind(i,j)] = CBY(i,j)*BY(i,j) + CBYMY1(i,j)*MY(i,j) - CBYMY0(i,j)*nowMy;
    }
  }
}
Пример #6
0
static bfd_boolean
MY(write_object_contents)(bfd *abfd)
{
  struct external_exec exec_bytes;
  struct internal_exec *execp = exec_hdr(abfd);

  /* Magic number, maestro, please!  */
  switch (bfd_get_arch(abfd))
    {
    case bfd_arch_m68k:
      switch (bfd_get_mach (abfd))
	{
	case bfd_mach_m68010:
	  N_SET_MACHTYPE (*execp, M_68010);
	  break;
	default:
	case bfd_mach_m68020:
	  N_SET_MACHTYPE (*execp, M_68020);
	  break;
	}
      break;
    case bfd_arch_sparc:
      N_SET_MACHTYPE (*execp, M_SPARC);
      break;
    case bfd_arch_i386:
      N_SET_MACHTYPE (*execp, M_386);
      break;
    case bfd_arch_a29k:
      N_SET_MACHTYPE (*execp, M_29K);
      break;
    case bfd_arch_mips:
      switch (bfd_get_mach (abfd))
	{
	case bfd_mach_mips4000:
	case bfd_mach_mips6000:
	  N_SET_MACHTYPE (*execp, M_MIPS2);
	  break;
	default:
	  N_SET_MACHTYPE (*execp, M_MIPS1);
	  break;
	}
      break;
    default:
      N_SET_MACHTYPE (*execp, M_UNKNOWN);
    }

  MY (choose_reloc_size) (abfd);

  WRITE_HEADERS (abfd, execp);

  return TRUE;
}
Пример #7
0
				   reloc_howto_type *,
				   struct reloc_std_external *));

extern void MY(relocatable_reloc) PARAMS ((reloc_howto_type *, bfd *,
					   struct reloc_std_external *,
					   bfd_vma *, bfd_vma));

extern reloc_howto_type * MY(reloc_type_lookup)
		PARAMS ((bfd *, bfd_reloc_code_real_type));

reloc_howto_type MY(howto_table)[] = {
  /* type   rs size bsz pcrel bitpos ovrf                     sf		  name     part_inpl readmask setmask     pcdone */
  HOWTO( 0, 0, 0,   8,  false, 0, complain_overflow_bitfield, 0			   , "8",      true, 0x000000ff, 0x000000ff, false),
  HOWTO( 1, 0, 1,   16, false, 0, complain_overflow_bitfield, 0			   , "16",     true, 0x0000ffff, 0x0000ffff, false),
  HOWTO( 2, 0, 2,   32, false, 0, complain_overflow_bitfield, 0			   , "32",     true, 0xffffffff, 0xffffffff, false),
  HOWTO( 3, 2, 2,   26, true,  0, complain_overflow_signed,   MY(fix_pcrel_26)	   , "ARM26",  true, 0x00ffffff, 0x00ffffff, true),
  HOWTO( 4, 0, 0,   8,  true,  0, complain_overflow_signed,   0			   , "DISP8",  true, 0x000000ff, 0x000000ff, true),
  HOWTO( 5, 0, 1,   16, true,  0, complain_overflow_signed,   0			   , "DISP16", true, 0x0000ffff, 0x0000ffff, true),
  HOWTO( 6, 0, 2,   32, true,  0, complain_overflow_signed,   0			   , "DISP32", true, 0xffffffff, 0xffffffff, true),
  HOWTO( 7, 2, 2,   26, false, 0, complain_overflow_dont,     MY(fix_pcrel_26_done), "ARM26D", true, 0x00000000, 0x00000000, false),
  {-1},
  HOWTO( 9, 0, -1,  16, false, 0, complain_overflow_bitfield, 0			   , "NEG16",  true, 0x0000ffff, 0x0000ffff, false),
  HOWTO(10, 0, -2,  32, false, 0, complain_overflow_bitfield, 0			   , "NEG32",  true, 0xffffffff, 0xffffffff, false),
  {-1}
};

#define RELOC_ARM_BITS_NEG_BIG      ((unsigned int) 0x08)
#define RELOC_ARM_BITS_NEG_LITTLE   ((unsigned int) 0x10)

#define ARMAOUT_TABLE_SIZE \
  (sizeof (MY(howto_table)) / sizeof (reloc_howto_type))
Пример #8
0
  obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;

  WRITE_HEADERS (abfd, execp);

  return TRUE;
}

#define MY_write_object_contents  i386aout_write_object_contents
#define MY_backend_data           & MY (backend_data)

static const struct aout_backend_data MY (backend_data);

#include "aout-target.h"

static const struct aout_backend_data MY (backend_data) =
{
  0,				/* Zmagic contiguous.  */
  1,				/* Text incl header.  */
  0,				/* Entry is text address.  */
  0,				/* Exec_hdr_flags.  */
  0,				/* Text vma?  */
  MY (set_sizes),
  1,				/* Exec header not counted.  */
  0,				/* Add_dynamic_symbols.  */
  0,				/* Add_one_symbol.  */
  0,				/* Link_dynamic_object.  */
  0,				/* Write_dynamic_symbol.  */
  0,				/* Check_dynamic_reloc.  */
  0				/* Finish_dynamic_link.  */
};
Пример #9
0
USI
MY (f_break_handler) (SIM_CPU *cpu, USI breaknum, USI pc)
{
    SIM_DESC sd = CPU_STATE (cpu);
    USI ret = pc + 2;

    MY (f_h_pc_set) (cpu, ret);

    /* FIXME: Error out if IBR or ERP set.  */
    switch (breaknum)
    {
    case 13:
        MY (f_h_gr_set (cpu, 10,
                        cris_break_13_handler (cpu,
                                               MY (f_h_gr_get (cpu, 9)),
                                               MY (f_h_gr_get (cpu, 10)),
                                               MY (f_h_gr_get (cpu, 11)),
                                               MY (f_h_gr_get (cpu, 12)),
                                               MY (f_h_gr_get (cpu, 13)),
                                               MY (f_h_sr_get (cpu, 7)),
                                               MY (f_h_sr_get (cpu, 11)),
                                               pc)));
        break;

    case 14:
        sim_io_printf (sd, "%x\n", MY (f_h_gr_get (cpu, 3)));
        break;

    case 15:
        /* Re-use the Linux exit call.  */
        cris_break_13_handler (cpu, /* TARGET_SYS_exit */ 1, 0,
                               0, 0, 0, 0, 0, pc);

    default:
        abort ();
    }

    return MY (f_h_pc_get) (cpu);
}
Пример #10
0
					   arelent *, asymbol **,
					   bfd_size_type));
void MY(swap_std_reloc_out) PARAMS ((bfd *, arelent *, 
				     struct reloc_std_external *));

reloc_howto_type MY(howto_table)[] =
{
  /* type rs size bsz pcrel bitpos ovrf sf name part_inpl readmask setmask
     pcdone */
  HOWTO (0, 0, 0, 8, false, 0, complain_overflow_bitfield, 0, "8", true,
	 0x000000ff, 0x000000ff, false),
  HOWTO (1, 0, 1, 16, false, 0, complain_overflow_bitfield, 0, "16", true,
	 0x0000ffff, 0x0000ffff, false),
  HOWTO (2, 0, 2, 32, false, 0, complain_overflow_bitfield, 0, "32", true,
	 0xffffffff, 0xffffffff, false),
  HOWTO (3, 2, 2, 26, true, 0, complain_overflow_signed, MY(fix_pcrel_26),
	 "ARM26", true, 0x00ffffff, 0x00ffffff, true),
  HOWTO (4, 0, 0, 8, true, 0, complain_overflow_signed, 0, "DISP8", true,
	 0x000000ff, 0x000000ff, true),
  HOWTO (5, 0, 1, 16, true, 0, complain_overflow_signed, 0, "DISP16", true,
	 0x0000ffff, 0x0000ffff, true),
  HOWTO (6, 0, 2, 32, true, 0, complain_overflow_signed, 0, "DISP32", true,
	 0xffffffff, 0xffffffff, true),
  HOWTO (7, 2, 2, 26, false, 0, complain_overflow_signed,
	 MY(fix_pcrel_26_done), "ARM26D", true, 0x0, 0x0,
	 false),
  {-1},
  HOWTO (9, 0, -1, 16, false, 0, complain_overflow_bitfield, 0, "NEG16", true,
	 0x0000ffff, 0x0000ffff, false),
  HOWTO (10, 0, -2, 32, false, 0, complain_overflow_bitfield, 0, "NEG32", true,
	 0xffffffff, 0xffffffff, false),
Пример #11
0
  PARAMS ((reloc_howto_type *, bfd *, struct reloc_std_external *, bfd_vma *,
	   bfd_vma));
void MY(swap_std_reloc_out)
  PARAMS ((bfd *, arelent *, struct reloc_std_external *));

reloc_howto_type MY(howto_table)[] =
  {
    /* Type rs size bsz pcrel bitpos ovrf sf name part_inpl
       readmask setmask pcdone.  */
    HOWTO (0, 0, 0, 8, FALSE, 0, complain_overflow_bitfield, 0, "8", TRUE,
	   0x000000ff, 0x000000ff, FALSE),
    HOWTO (1, 0, 1, 16, FALSE, 0, complain_overflow_bitfield, 0, "16", TRUE,
	   0x0000ffff, 0x0000ffff, FALSE),
    HOWTO (2, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, 0, "32", TRUE,
	   0xffffffff, 0xffffffff, FALSE),
    HOWTO (3, 2, 2, 26, TRUE, 0, complain_overflow_signed, MY(fix_pcrel_26),
	   "ARM26", TRUE, 0x00ffffff, 0x00ffffff, TRUE),
    HOWTO (4, 0, 0, 8, TRUE, 0, complain_overflow_signed, 0, "DISP8", TRUE,
	   0x000000ff, 0x000000ff, TRUE),
    HOWTO (5, 0, 1, 16, TRUE, 0, complain_overflow_signed, 0, "DISP16", TRUE,
	   0x0000ffff, 0x0000ffff, TRUE),
    HOWTO (6, 0, 2, 32, TRUE, 0, complain_overflow_signed, 0, "DISP32", TRUE,
	   0xffffffff, 0xffffffff, TRUE),
    HOWTO (7, 2, 2, 26, FALSE, 0, complain_overflow_signed,
	   MY(fix_pcrel_26_done), "ARM26D", TRUE, 0x0, 0x0,
	   FALSE),
    EMPTY_HOWTO (-1),
    HOWTO (9, 0, -1, 16, FALSE, 0, complain_overflow_bitfield, 0, "NEG16", TRUE,
	   0x0000ffff, 0x0000ffff, FALSE),
    HOWTO (10, 0, -2, 32, FALSE, 0, complain_overflow_bitfield, 0, "NEG32", TRUE,
	   0xffffffff, 0xffffffff, FALSE)
Пример #12
0
static bfd_boolean
MY (write_object_contents) (bfd * abfd)
{
  struct external_exec exec_bytes;
  struct internal_exec *execp = exec_hdr (abfd);
  bfd_size_type text_size;	/* dummy vars */
  file_ptr text_end;

  memset (&exec_bytes, 0, sizeof (exec_bytes));

  obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;

  if (adata (abfd).magic == undecided_magic)
    NAME (aout,adjust_sizes_and_vmas) (abfd, &text_size, &text_end);
  execp->a_syms = 0;

  execp->a_entry = bfd_get_start_address (abfd);

  execp->a_trsize = ((obj_textsec (abfd)->reloc_count) *
		     obj_reloc_entry_size (abfd));
  execp->a_drsize = ((obj_datasec (abfd)->reloc_count) *
		     obj_reloc_entry_size (abfd));

  N_SET_MACHTYPE (*execp, 0xc);
  N_SET_FLAGS (*execp, aout_backend_info (abfd)->exec_hdr_flags);

  NAME (aout,swap_exec_header_out) (abfd, execp, &exec_bytes);

  /* update fields not covered by default swap_exec_header_out */

  /* this is really the sym table size but we store it in drelocs */
  H_PUT_32 (abfd, (bfd_get_symcount (abfd) * 12), exec_bytes.e_drelocs);

  if (bfd_seek (abfd, (file_ptr) 0, FALSE) != 0
      || (bfd_bwrite (&exec_bytes, (bfd_size_type) EXEC_BYTES_SIZE, abfd)
	  != EXEC_BYTES_SIZE))
    return FALSE;

  /* Write out the symbols, and then the relocs.  We must write out
       the symbols first so that we know the symbol indices.  */

  if (bfd_get_symcount (abfd) != 0)
    {
      /* Skip the relocs to where we want to put the symbols.  */
      if (bfd_seek (abfd, (file_ptr) (N_DRELOFF (*execp) + execp->a_drsize),
		    SEEK_SET) != 0)
	return FALSE;
    }

  if (!MY (write_syms) (abfd))
    return FALSE;

  if (bfd_get_symcount (abfd) != 0)
    {
      if (bfd_seek (abfd, (file_ptr) N_TRELOFF (*execp), SEEK_CUR) != 0)
	return FALSE;
      if (!NAME (aout,squirt_out_relocs) (abfd, obj_textsec (abfd)))
	return FALSE;
      if (bfd_seek (abfd, (file_ptr) N_DRELOFF (*execp), SEEK_CUR) != 0)
	return FALSE;
      if (!NAME (aout,squirt_out_relocs) (abfd, obj_datasec (abfd)))
	return FALSE;
    }

  return TRUE;
}
Пример #13
0
		bool CMysqlDBApi::InsertAvatarObject(_U32 avatar_id, const A_UUID& _uuid, const char* type, const char* data)
		{
			char suuid[100];
			AUuidToString(_uuid, suuid);
			String sql = StringFormat("INSERT INTO avatar_object_table values(%u, '%s', '%s', '%s')", avatar_id, suuid, MY(type), MY(data));
			if(mysql_real_query(m_mysql, sql.c_str(), (unsigned long)sql.size())!=0)
			{
				printf("error in mysql_real_query(%d), %s", mysql_errno(m_mysql), mysql_error(m_mysql));
				return false;
			}
			return true;
		}