Пример #1
0
def print_cmd_def(db):

	#打印DB的头部
	print "<table id=\"mytable\" cellspacing=\"0\" >";
	if	db["dbid"]<>"":
		print	"<caption >%s:%s:%s</caption>"%(db["dbid"],db["dbname"], 
			gendoc_core.db_conf[ str(gendoc_core.get_db_type(eval( db["dbid"])))][2]   );
	else:
		print	"<caption >%s:%s</caption>"%(db["dbid"],db["dbname"] );
	print "<tr><th>命令号</th><th>名字</th><th>说明</th></tr>"
		
	cmdlist=db["cmdlist"];
	keylist=cmdlist.keys();
	keylist.sort(gendoc_core.cmd_sort_cmp);

	for k in keylist:
		cmditem=cmdlist[k]
		cmdname=cmditem["cmdname"];
		cmdid=cmditem["cmdid"];
		comment=gendoc_core.get_cmd_info(k)[2]
		print("<tr><td>%s</td><td><a name=%s_2 href=\"#%s_1\">%s</a></td><td>%s</td></tr>"%( cmdid,
					cmdname,cmdname,cmdname,comment))
		pass

	print "</table>";
Пример #2
0
def print_cmd_def(db):

    #打印DB的头部
    print "<table id=\"mytable\" cellspacing=\"0\" >"
    if db["dbid"] <> "":
        print "<caption >%s:%s:%s</caption>" % (
            db["dbid"], db["dbname"], gendoc_core.db_conf[str(
                gendoc_core.get_db_type(eval(db["dbid"])))][2])
    else:
        print "<caption >%s:%s</caption>" % (db["dbid"], db["dbname"])
    print "<tr><th>命令号</th><th>名字</th><th>说明</th></tr>"

    cmdlist = db["cmdlist"]
    keylist = cmdlist.keys()
    keylist.sort(gendoc_core.cmd_sort_cmp)

    for k in keylist:
        cmditem = cmdlist[k]
        cmdname = cmditem["cmdname"]
        cmdid = cmditem["cmdid"]
        comment = gendoc_core.get_cmd_info(k)[2]
        print(
            "<tr><td>%s</td><td><a name=%s_2 href=\"#%s_1\">%s</a></td><td>%s</td></tr>"
            % (cmdid, cmdname, cmdname, cmdname, comment))
        pass

    print "</table>"
Пример #3
0
def print_all_cmd_def(db):
	#打印DB的头部
	cmdlist=db["cmdlist"];
	keylist=cmdlist.keys();
	keylist.sort(gendoc_core.cmd_sort_cmp);

	id=0
	for k in keylist:
		cmditem=cmdlist[k]
		cmdname=cmditem["cmdname"];
		cmdid=cmditem["cmdid"];
		comment=gendoc_core.get_cmd_info(k)[2]
		need_update_flag=cmditem["need_update"]

		print "<table id=\"mytable_1\" cellspacing=\"0\" >";
		print "<tr><th width=50 class=\"title_def\">%d</th><th class=\"title_def\"><a name=%s_1 href=#%s_2 >%s</a> <a href='JavaScript:;' onclick=\"div_show('%s_php_code');\">php协议代码</a><br />%s</th><th class=\"title_def\" width=100 >%s<br />%s</th></tr>"%(
				id,cmdname,cmdname, cmdname,cmdname, comment, cmdid,need_update_flag )
		print "</table>"		

		php_code= gendoc_core.get_php_code(cmditem);
		print "<div id='%s_php_code' style='display:none;' align=center ><table><td class=alt> <pre>%s</pre></td></table></div>"%(cmdname,php_code)	
		in_stru=cmditem["in_stru"];
		#打印请求
		#print header
		print "<table id=\"mytable\" cellspacing=\"0\" >";
		print	"<caption >请求包:</caption>";
		print "<tr><th>字段</th><th>类型</th><th>说明</th></tr>"
	#	print in_stru;	
		len_in=len(in_stru);
		if (len_in==1 ):
			show_struct(in_stru[0]);
		elif (len_in==2 ):
			show_struct(in_stru[0],"");
			in_1=in_stru[1];
			print("<tr><td>%s</td><td>无</td><td>%s</td></tr>"%( in_1["struct_name"],
									gendoc_core.fd.getDesc(in_1["struct_name"] )))
			show_struct(in_1 ,">>>>&nbsp;" )
		elif (len_in>2):
			show_struct(in_stru[0],"");
			for i in range (1,len_in):
				in_item=in_stru[i];
				print("<tr><td>%s</td><td>无</td><td>%s</td></tr>"%(in_item["struct_name"],
									gendoc_core.fd.getDesc(in_item["struct_name"] )))

				show_struct(in_item,">>>>&nbsp;" )
		print "</table>";

		#打印返回包
		#print header
		print "<table id=\"mytable\" cellspacing=\"0\" >";
		print	"<caption >返回包:</caption>";
		print "<tr><th>字段</th><th>类型</th><th>说明</th></tr>"

		out_stru=cmditem["out_stru"];
	#	print out_stru;
		len_out=len(out_stru);
		if (len_out==1 ):
			show_struct(out_stru[0]);
		elif (len_out==2 ):
			show_struct(out_stru[0],"");
			out_1=out_stru[1];
			print("<tr><td>%s</td><td>无</td><td>%s</td></tr>"%( out_1["struct_name"],
									gendoc_core.fd.getDesc(out_1["struct_name"] )))
			show_struct(out_1 ,">>>>&nbsp;" )
		elif (len_out>2):
			show_struct(out_stru[0],"");
			for i in range (1,len_out):
				out_item=out_stru[i];
				print("<tr><td>%s</td><td>无</td><td>%s</td></tr>"%(out_item["struct_name"],
									gendoc_core.fd.getDesc(out_item["struct_name"] )))

				show_struct(out_item,">>>>&nbsp;" )
		print "</table>";

		#错误码
		print "<table id=\"mytable\" cellspacing=\"0\" >";
		print "<caption >错误码:</caption>";
		print "<tr><th>名字</th><th>数值</th><th>说明</th></tr>"
		err_list= cmditem["errlist"];
		for k in err_list .keys():
			err=err_list[k]
			v = gendoc_core .err_conf[err];
			print ( "<tr ><td >%s</td><td>%s</td><td>%s</td></tr>"%( err,v[0], v[1] ))
		print "</table>"		
		print "<br />"		

		id=id+1;
Пример #4
0
def print_all_cmd_def(db):
    #打印DB的头部
    cmdlist = db["cmdlist"]
    keylist = cmdlist.keys()
    keylist.sort(gendoc_core.cmd_sort_cmp)

    id = 0
    for k in keylist:
        cmditem = cmdlist[k]
        cmdname = cmditem["cmdname"]
        cmdid = cmditem["cmdid"]
        comment = gendoc_core.get_cmd_info(k)[2]
        need_update_flag = cmditem["need_update"]

        print "<table id=\"mytable_1\" cellspacing=\"0\" >"
        print "<tr><th width=50 class=\"title_def\">%d</th><th class=\"title_def\"><a name=%s_1 href=#%s_2 >%s</a> <a href='JavaScript:;' onclick=\"div_show('%s_php_code');\">php协议代码</a><br />%s</th><th class=\"title_def\" width=100 >%s<br />%s</th></tr>" % (
            id, cmdname, cmdname, cmdname, cmdname, comment, cmdid,
            need_update_flag)
        print "</table>"

        php_code = gendoc_core.get_php_code(cmditem)
        print "<div id='%s_php_code' style='display:none;' align=center ><table><td class=alt> <pre>%s</pre></td></table></div>" % (
            cmdname, php_code)
        in_stru = cmditem["in_stru"]
        #打印请求
        #print header
        print "<table id=\"mytable\" cellspacing=\"0\" >"
        print "<caption >请求包:</caption>"
        print "<tr><th>字段</th><th>类型</th><th>说明</th></tr>"
        #	print in_stru;
        len_in = len(in_stru)
        if (len_in == 1):
            show_struct(in_stru[0])
        elif (len_in == 2):
            show_struct(in_stru[0], "")
            in_1 = in_stru[1]
            print("<tr><td>%s</td><td>无</td><td>%s</td></tr>" %
                  (in_1["struct_name"],
                   gendoc_core.fd.getDesc(in_1["struct_name"])))
            show_struct(in_1, ">>>>&nbsp;")
        elif (len_in > 2):
            show_struct(in_stru[0], "")
            for i in range(1, len_in):
                in_item = in_stru[i]
                print("<tr><td>%s</td><td>无</td><td>%s</td></tr>" %
                      (in_item["struct_name"],
                       gendoc_core.fd.getDesc(in_item["struct_name"])))

                show_struct(in_item, ">>>>&nbsp;")
        print "</table>"

        #打印返回包
        #print header
        print "<table id=\"mytable\" cellspacing=\"0\" >"
        print "<caption >返回包:</caption>"
        print "<tr><th>字段</th><th>类型</th><th>说明</th></tr>"

        out_stru = cmditem["out_stru"]
        #	print out_stru;
        len_out = len(out_stru)
        if (len_out == 1):
            show_struct(out_stru[0])
        elif (len_out == 2):
            show_struct(out_stru[0], "")
            out_1 = out_stru[1]
            print("<tr><td>%s</td><td>无</td><td>%s</td></tr>" %
                  (out_1["struct_name"],
                   gendoc_core.fd.getDesc(out_1["struct_name"])))
            show_struct(out_1, ">>>>&nbsp;")
        elif (len_out > 2):
            show_struct(out_stru[0], "")
            for i in range(1, len_out):
                out_item = out_stru[i]
                print("<tr><td>%s</td><td>无</td><td>%s</td></tr>" %
                      (out_item["struct_name"],
                       gendoc_core.fd.getDesc(out_item["struct_name"])))

                show_struct(out_item, ">>>>&nbsp;")
        print "</table>"

        #错误码
        print "<table id=\"mytable\" cellspacing=\"0\" >"
        print "<caption >错误码:</caption>"
        print "<tr><th>名字</th><th>数值</th><th>说明</th></tr>"
        err_list = cmditem["errlist"]
        for k in err_list.keys():
            err = err_list[k]
            v = gendoc_core.err_conf[err]
            print("<tr ><td >%s</td><td>%s</td><td>%s</td></tr>" %
                  (err, v[0], v[1]))
        print "</table>"
        print "<br />"

        id = id + 1