コード例 #1
0
ファイル: rpc_clntout.c プロジェクト: edgar-pek/PerspicuOS
static void
write_program(definition *def)
{
	version_list *vp;
	proc_list *proc;

	for (vp = def->def.pr.versions; vp != NULL; vp = vp->next) {
		for (proc = vp->procs; proc != NULL; proc = proc->next) {
			f_print(fout, "\n");
			if (mtflag == 0) {
				ptype(proc->res_prefix, proc->res_type, 1);
				f_print(fout, "*\n");
				pvname(proc->proc_name, vp->vers_num);
				printarglist(proc, RESULT, "clnt", "CLIENT *");
			} else {
				f_print(fout, "enum clnt_stat \n");
				pvname(proc->proc_name, vp->vers_num);
				printarglist(proc, RESULT,  "clnt", "CLIENT *");

			}
			f_print(fout, "{\n");
			printbody(proc);

			f_print(fout, "}\n");
		}
	}
}
コード例 #2
0
ファイル: rpc_sample.c プロジェクト: Alkzndr/freebsd
static void
write_sample_server(definition *def)
{
	version_list *vp;
	proc_list *proc;

	for (vp = def->def.pr.versions; vp != NULL; vp = vp->next) {
		for (proc = vp->procs; proc != NULL; proc = proc->next) {
			f_print(fout, "\n");
			if (!mtflag) {
				return_type(proc);
				f_print(fout, "*\n");
			} else
				f_print(fout, "bool_t\n");
			pvname_svc(proc->proc_name, vp->vers_num);
			printarglist(proc, "result", RQSTP, "struct svc_req *");

			f_print(fout, "{\n");
			if (!mtflag) {
				f_print(fout, "\tstatic ");
				if(!streq(proc->res_type, "void"))
					return_type(proc);
				else
					f_print(fout, "char *");
				/* cannot have void type */
				f_print(fout, " result;\n");
			}
			else
				f_print(fout, "\tbool_t retval;\n");
			f_print(fout,
				"\n\t/*\n\t * insert server code here\n\t */\n\n");

			if (!mtflag)
				if(!streq(proc->res_type, "void"))
					f_print(fout, "\treturn (&result);\n}\n");
				else /* cast back to void * */
					f_print(fout, "\treturn((void *) &result);\n}\n");
			else
				f_print(fout, "\treturn (retval);\n}\n");
		}
		/* put in sample freeing routine */
		if (mtflag) {
		f_print(fout, "\nint\n");
		pvname(def->def_name, vp->vers_num);
		f_print(fout,"_freeresult(SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result)\n");
		f_print(fout, "{\n");
		f_print(fout, "\t(void) xdr_free(xdr_result, result);\n");
		f_print(fout,
			"\n\t/*\n\t * Insert additional freeing code here, if needed\n\t */\n");
		f_print(fout, "\n}\n");

		
	}
	}
}
コード例 #3
0
ファイル: rpc_sample.c プロジェクト: ANFS/ANFS-utils
static void
write_sample_server(definition * def)
{
	version_list   *vp;
	proc_list      *proc;

	for (vp = def->def.pr.versions; vp != NULL; vp = vp->next) {
		for (proc = vp->procs; proc != NULL; proc = proc->next) {
			f_print(fout, "\n");
			/*			if( Cflag )
			  f_print( fout, "extern \"C\"{\n");
*/
			return_type(proc);
			f_print(fout, "* \n");
			if (Cflag)
				pvname_svc(proc->proc_name, vp->vers_num);
			else
				pvname(proc->proc_name, vp->vers_num);
			printarglist(proc, RQSTP, "struct svc_req *");

			f_print(fout, "{\n");
			f_print(fout, "\n\tstatic ");
			if (!streq(proc->res_type, "void"))
				return_type(proc);
			else
				f_print(fout, "char*");	/* cannot have void type */
			/* f_print(fout, " result;\n", proc->res_type); */
			f_print(fout, " result;\n");
			f_print(fout,
				"\n\t/*\n\t * insert server code here\n\t */\n\n");
			if (!streq(proc->res_type, "void"))
				f_print(fout, "\treturn(&result);\n}\n");
			else	/* cast back to void * */
				f_print(fout, "\treturn((void*) &result);\n}\n");
			/*			if( Cflag)
			  f_print( fout, "};\n");
*/

		}
	}
}