软件著作权申请源程序
计算机软件著作权登记-源代码范本
计算机软件著作权登记-源代码范本注意事项:常见的源代码包含:C语言,VB,C++,JAVA,.NET等。
提交的代码必须是源代码的开头载入程序,第30页必须断开,第60页是软件的程序结尾,代码中不得出现与申请表内容不符合的日期,著作权人,软件名字等,不能出现开源代码,不能出现任何版权纠纷。
格式要求:一、源代码应提交前、后各连续30页,不足60页的,应当全部提交。
二、源代码页眉应标注软件的名称和版本号,应当与申请表中名称完全一致,页眉右上应标注页码,源代码每页不少于50行。
范例如下:#include <tybs/>#include <tybs/>#include <tybs/>#include <tybs/>#include <tybs/>#include <tybs/>#include <tybs/>#include <tybs/>#include <tybs/>#include <tybs/>#include <tybs/>#include <tybs/>#include <tybs/>#include <tybscc/>#include <dns/>#include <dns/>#include <dns/>#include <dns/>#include <dst/>#define NS_MAIN 1#include <named/>#endif#ifdef DLZ#include <dlz/>#endifstatic tybs_boolean_t want_stats = TYBS_FALSE;static char program_name[TYBS_DIR_NAMEMAX] = "named"; static char absolute_conffile[TYBS_DIR_PATHMAX];static char saved_command_line[512];static char version[512];static unsigned int maxsocks = 0;voidns_main_earlywarning(const char *format, ...) {va_list args;va_start(args, format);if (ns_g_lctx != NULL) {tybs_log_vwrite(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN, TYBS_LOG_WARNING,format, args);} else {fprintf(stderr, "%s: ", program_name);vfprintf(stderr, format, args);fprintf(stderr, "\n");fflush(stderr);}va_end(args);}Void ns_main_earlyfatal(const char *format, ...) {va_list args;va_start(args, format);if (ns_g_lctx != NULL) {tybs_log_vwrite(ns_g_lctx, NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN, TYBS_LOG_CRITICAL,format, args);tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN, TYBS_LOG_CRITICAL,"exiting (due to early fatal error)");} else {fprintf(stderr, "%s: ", program_name);vfprintf(stderr, format, args);fprintf(stderr, "\n");fflush(stderr);}va_end(args);exit(1);}static voidassertion_failed(const char *file, int line, tybs_assertiontype_t type, const char *cond){if (ns_g_lctx != NULL) {tybs_assertion_setcallback(NULL);tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN, TYBS_LOG_CRITICAL,"%s:%d: %s(%s) failed", file, line,tybs_assertion_typetotext(type), cond);tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN, TYBS_LOG_CRITICAL,"exiting (due to assertion failure)");} else {fprintf(stderr, "%s:%d: %s(%s) failed\n",file, line, tybs_assertion_typetotext(type), cond);fflush(stderr);}if (ns_g_coreok)abort();exit(1);}static voidlibrary_fatal_error(const char *file, int line, const char *format, va_list args) TYBS_FORMAT_PRINTF(3, 0);static voidlibrary_fatal_error(const char *file, int line, const char *format, va_list args){if (ns_g_lctx != NULL) {tybs_error_setfatal(NULL);tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN, TYBS_LOG_CRITICAL,"%s:%d: fatal error:", file, line);tybs_log_vwrite(ns_g_lctx, NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN, TYBS_LOG_CRITICAL,format, args);tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN, TYBS_LOG_CRITICAL,"exiting (due to fatal error in library)");} else {fprintf(stderr, "%s:%d: fatal error: ", file, line);vfprintf(stderr, format, args);fprintf(stderr, "\n");fflush(stderr);}if (ns_g_coreok)abort();exit(1);}static voidlibrary_unexpected_error(const char *file, int line, const char *format, va_list args) TYBS_FORMAT_PRINTF(3, 0);static voidlibrary_unexpected_error(const char *file, int line, const char *format, va_list args){if (ns_g_lctx != NULL) {tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN, TYBS_LOG_ERROR,"%s:%d: unexpected error:", file, line);tybs_log_vwrite(ns_g_lctx, NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN, TYBS_LOG_ERROR,format, args);} else {fprintf(stderr, "%s:%d: fatal error: ", file, line);vfprintf(stderr, format, args);fprintf(stderr, "\n");fflush(stderr);}}static voidlwresd_usage(void) {fprintf(stderr,"usage: lwresd [-4|-6] [-c conffile | -C resolvconffile] ""[-d debuglevel]\n"" [-f|-g] [-n number_of_cpus] [-p port] ""[-P listen-port] [-s]\n"" [-t chrootdir] [-u username] [-i pidfile]\n"" [-m {usage|trace|record|size|mctx}]\n");}static voidusage(void) {if (ns_g_lwresdonly) {lwresd_usage();return;}fprintf(stderr,"usage: named [-4|-6] [-c conffile] [-d debuglevel] ""[-f|-g] [-n number_of_cpus]\n"" [-p port] [-s] [-t chrootdir] [-u username]\n"" [-m {usage|trace|record|size|mctx}]\n");}static voidsave_command_line(int argc, char *argv[]) {int i;char *src;char *dst;char *eob;const char truncated[] = "...";tybs_boolean_t quoted = TYBS_FALSE;dst = saved_command_line;eob = saved_command_line + sizeof(saved_command_line);for (i = 1; i < argc && dst < eob; i++) {*dst++ = ' ';src = argv[i];while (*src != '\0' && dst < eob) {if (quoted || isalnum(*src & 0xff) ||*src == '-' || *src == '_' ||*src == '.' || *src == '/') {*dst++ = *src++;quoted = TYBS_FALSE;} else {*dst++ = '\\';quoted = TYBS_TRUE;}}}INSIST(sizeof(saved_command_line) >= sizeof(truncated));if (dst == eob)strcpy(eob - sizeof(truncated), truncated);else*dst = '\0';}static intparse_int(char *arg, const char *desc) {char *endp;int tmp;long int ltmp;ltmp = strtol(arg, &endp, 10);tmp = (int) ltmp;if (*endp != '\0')ns_main_earlyfatal("%s '%s' must be numeric", desc, arg);if (tmp < 0 || tmp != ltmp)ns_main_earlyfatal("%s '%s' out of range", desc, arg);return (tmp);}static struct flag_def {const char *name;unsigned int value;} mem_debug_flags[] = {{ "trace", TYBS_MEM_DEBUGTRACE },{ "record", TYBS_MEM_DEBUGRECORD },{ "usage", TYBS_MEM_DEBUGUSAGE },{ "size", TYBS_MEM_DEBUGSIZE },{ "mctx", TYBS_MEM_DEBUGCTX },{ NULL, 0 }};static voidset_flags(const char *arg, struct flag_def *defs, unsigned int *ret) { for (;;) {const struct flag_def *def;const char *end = strchr(arg, ',');int arglen;if (end == NULL)end = arg + strlen(arg);arglen = end - arg;for (def = defs; def->name != NULL; def++) {if (arglen == (int)strlen(def->name) &&memcmp(arg, def->name, arglen) == 0) {*ret |= def->value;goto found;}}ns_main_earlyfatal("unrecognized flag '%.*s'", arglen, arg);found:if (*end == '\0')break;arg = end + 1;}}static voidparse_command_line(int argc, char *argv[]) {int ch;int port;tybs_boolean_t disable6 = TYBS_FALSE;tybs_boolean_t disable4 = TYBS_FALSE;save_command_line(argc, argv);tybs_commandline_errprint = TYBS_FALSE;while ((ch = tybs_commandline_parse(argc, argv,"46c:C:d:fgi:lm:n:N:p:P:""sS:t:T:u:vVx:")) != -1) {switch (ch) {case '4':if (disable4)ns_main_earlyfatal("cannot specify -4 and -6");if (tybs_net_probeipv4() != TYBS_R_SUCCESS)ns_main_earlyfatal("IPv4 not supported by OS");tybs_net_disableipv6();disable6 = TYBS_TRUE;break;case '6':if (disable6)ns_main_earlyfatal("cannot specify -4 and -6");if (tybs_net_probeipv6() != TYBS_R_SUCCESS)ns_main_earlyfatal("IPv6 not supported by OS");tybs_net_disableipv4();disable4 = TYBS_TRUE;break;case 'c':ns_g_conffile = tybs_commandline_argument;lwresd_g_conffile = tybs_commandline_argument;if (lwresd_g_useresolvconf)ns_main_earlyfatal("cannot specify -c and -C");ns_g_conffileset = TYBS_TRUE;break;case 'C':lwresd_g_resolvconffile = tybs_commandline_argument;if (ns_g_conffileset)ns_main_earlyfatal("cannot specify -c and -C");lwresd_g_useresolvconf = TYBS_TRUE;break;case 'd':ns_g_debuglevel = parse_int(tybs_commandline_argument,"debug level");break;case 'f':ns_g_foreground = TYBS_TRUE;break;case 'g':ns_g_foreground = TYBS_TRUE;ns_g_logstderr = TYBS_TRUE;break;/* XXXBEW -i should be removed */case 'i':lwresd_g_defaultpidfile = tybs_commandline_argument;break;case 'l':ns_g_lwresdonly = TYBS_TRUE;break;case 'm':set_flags(tybs_commandline_argument, mem_debug_flags, &tybs_mem_debugging);break;case 'N': /* Deprecated. */case 'n':ns_g_cpus = parse_int(tybs_commandline_argument,"number of cpus");if (ns_g_cpus == 0)ns_g_cpus = 1;break;case 'p':port = parse_int(tybs_commandline_argument, "port");if (port < 1 || port > 65535)ns_main_earlyfatal("port '%s' out of range",tybs_commandline_argument);ns_g_port = port;break;/* XXXBEW Should -P be removed? */case 'P':port = parse_int(tybs_commandline_argument, "port");if (port < 1 || port > 65535)ns_main_earlyfatal("port '%s' out of range",tybs_commandline_argument);lwresd_g_listenport = port;break;case 's':want_stats = TYBS_TRUE;break;case 'S':maxsocks = parse_int(tybs_commandline_argument,"max number of sockets");break;case 't':ns_g_chrootdir = tybs_commandline_argument;break;case 'T':if (strcmp(tybs_commandline_argument, "clienttest") == 0) ns_g_clienttest = TYBS_TRUE;elsefprintf(stderr, "unknown -T flag '%s\n",tybs_commandline_argument);break;case 'u':ns_g_username = tybs_commandline_argument;break;case 'v':printf("BIND %s\n", ns_g_version);exit(0);case 'V':printf("BIND %s built with %s\n", ns_g_version,ns_g_configargs);exit(0);case '?':usage();if (tybs_commandline_option == '?')exit(0);ns_main_earlyfatal("unknown option '-%c'",tybs_commandline_option);default:ns_main_earlyfatal("parsing options returned %d", ch);}}argc -= tybs_commandline_index;argv += tybs_commandline_index;if (argc > 0) {usage();ns_main_earlyfatal("extra command line arguments");}}static tybs_result_tcreate_managers(void) {tybs_result_t result;unsigned int socks;#ifdef TYBS_PLATFORM_USETHREADSunsigned int cpus_detected;#endif#ifdef TYBS_PLATFORM_USETHREADScpus_detected = tybs_os_ncpus();if (ns_g_cpus == 0)ns_g_cpus = cpus_detected;tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER, TYBS_LOG_INFO, "found %u CPU%s, using %u worker thread%s",cpus_detected, cpus_detected == 1 ? "" : "s",ns_g_cpus, ns_g_cpus == 1 ? "" : "s");#elsens_g_cpus = 1;#endifresult = tybs_taskmgr_create(ns_g_mctx, ns_g_cpus, 0, &ns_g_taskmgr);if (result != TYBS_R_SUCCESS) {UNEXPECTED_ERROR(__FILE__, __LINE__,"tybs_taskmgr_create() failed: %s",tybs_result_totext(result));return (TYBS_R_UNEXPECTED);}result = tybs_timermgr_create(ns_g_mctx, &ns_g_timermgr);if (result != TYBS_R_SUCCESS) {UNEXPECTED_ERROR(__FILE__, __LINE__,"tybs_timermgr_create() failed: %s",tybs_result_totext(result));return (TYBS_R_UNEXPECTED);}result = tybs_socketmgr_create2(ns_g_mctx, &ns_g_socketmgr, maxsocks); if (result != TYBS_R_SUCCESS) {UNEXPECTED_ERROR(__FILE__, __LINE__,"tybs_socketmgr_create() failed: %s",tybs_result_totext(result));return (TYBS_R_UNEXPECTED);}result = tybs_socketmgr_getmaxsockets(ns_g_socketmgr, &socks);if (result == TYBS_R_SUCCESS) {tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_SERVER,TYBS_LOG_INFO, "using up to %u sockets", socks);}result = tybs_entropy_create(ns_g_mctx, &ns_g_entropy);if (result != TYBS_R_SUCCESS) {UNEXPECTED_ERROR(__FILE__, __LINE__,"tybs_entropy_create() failed: %s",tybs_result_totext(result));return (TYBS_R_UNEXPECTED);}result = tybs_hash_create(ns_g_mctx, ns_g_entropy, DNS_NAME_MAXWIRE); if (result != TYBS_R_SUCCESS) {UNEXPECTED_ERROR(__FILE__, __LINE__,"tybs_hash_create() failed: %s",tybs_result_totext(result));return (TYBS_R_UNEXPECTED);}return (TYBS_R_SUCCESS);}static voiddestroy_managers(void) {ns_lwresd_shutdown();tybs_entropy_detach(&ns_g_entropy);if (ns_g_fallbackentropy != NULL)tybs_entropy_detach(&ns_g_fallbackentropy);tybs_taskmgr_destroy(&ns_g_taskmgr);tybs_timermgr_destroy(&ns_g_timermgr);tybs_socketmgr_destroy(&ns_g_socketmgr);tybs_hash_destroy();}static voidsetup(void) {tybs_result_t result;#ifdef HAVE_LIBSCFchar *instance = NULL;#endifns_os_inituserinfo(ns_g_username);ns_os_tzset();ns_os_opendevnull();#ifdef HAVE_LIBSCFresult = ns_smf_get_instance(&instance, 0, ns_g_mctx);if (result == TYBS_R_SUCCESS)ns_smf_got_instance = 1;elsens_smf_got_instance = 0;if (instance != NULL)tybs_mem_free(ns_g_mctx, instance);#endif /* HAVE_LIBSCF */#ifdef PATH_RANDOMDEVif (ns_g_chrootdir != NULL) {result = tybs_entropy_create(ns_g_mctx, &ns_g_fallbackentropy);if (result != TYBS_R_SUCCESS)ns_main_earlyfatal("tybs_entropy_create() failed: %s",tybs_result_totext(result));result = tybs_entropy_createfilesource(ns_g_fallbackentropy,PATH_RANDOMDEV);if (result != TYBS_R_SUCCESS) {ns_main_earlywarning("could not open pre-chroot ""entropy source %s: %s",PATH_RANDOMDEV,tybs_result_totext(result));tybs_entropy_detach(&ns_g_fallbackentropy);}}#endifns_os_chroot(ns_g_chrootdir);ns_os_minprivs();result = ns_log_init(TYBS_TF(ns_g_username != NULL));if (result != TYBS_R_SUCCESS)ns_main_earlyfatal("ns_log_init() failed: %s",tybs_result_totext(result));if (!ns_g_foreground)ns_os_daemonize();result = tybs_app_start();if (result != TYBS_R_SUCCESS)ns_main_earlyfatal("tybs_app_start() failed: %s",tybs_result_totext(result));tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN, TYBS_LOG_NOTICE, "starting BIND %s%s", ns_g_version,saved_command_line);tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN, TYBS_LOG_NOTICE, "built with %s", ns_g_configargs);(void)tybs_resource_getlimit(tybs_resource_stacksize,&ns_g_initstacksize);(void)tybs_resource_getlimit(tybs_resource_datasize,&ns_g_initdatasize);(void)tybs_resource_getlimit(tybs_resource_coresize,&ns_g_initcoresize);(void)tybs_resource_getlimit(tybs_resource_openfiles,&ns_g_initopenfiles);if (! tybs_file_isabsolute(ns_g_conffile)) {result = tybs_file_absolutepath(ns_g_conffile,absolute_conffile,sizeof(absolute_conffile));if (result != TYBS_R_SUCCESS)ns_main_earlyfatal("could not construct absolute path of ""configuration file: %s",tybs_result_totext(result));ns_g_conffile = absolute_conffile;}result = tybs_time_now(&ns_g_boottime);if (result != TYBS_R_SUCCESS)ns_main_earlyfatal("tybs_time_now() failed: %s",tybs_result_totext(result));result = create_managers();if (result != TYBS_R_SUCCESS)ns_main_earlyfatal("create_managers() failed: %s",tybs_result_totext(result));ns_builtin_init();#ifdef DLZresult = dlz_drivers_init();if (result != TYBS_R_SUCCESS)ns_main_earlyfatal("dlz_drivers_init() failed: %s",tybs_result_totext(result));#endifns_server_create(ns_g_mctx, &ns_g_server);}static voidcleanup(void) {destroy_managers();ns_server_destroy(&ns_g_server);ns_builtin_deinit();#ifdef DLZdlz_drivers_clear();#endifdns_name_destroy();tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN, TYBS_LOG_NOTICE, "exiting");ns_log_shutdown();}static char *memstats = NULL;voidns_main_setmemstats(const char *filename) {if (memstats != NULL) {free(memstats);memstats = NULL;}if (filename == NULL)return;memstats = malloc(strlen(filename) + 1);if (memstats)strcpy(memstats, filename);}#ifdef HAVE_LIBSCFtybs_result_tns_smf_get_instance(char **ins_name, int debug, tybs_mem_t *mctx) { scf_handle_t *h = NULL;int namelen;char *instance;REQUIRE(ins_name != NULL && *ins_name == NULL);if ((h = scf_handle_create(SCF_VERSION)) == NULL) {if (debug)UNEXPECTED_ERROR(__FILE__, __LINE__,"scf_handle_create() failed: %s",scf_strerror(scf_error()));return (TYBS_R_FAILURE);}if (scf_handle_bind(h) == -1) {if (debug)UNEXPECTED_ERROR(__FILE__, __LINE__,"scf_handle_bind() failed: %s",scf_strerror(scf_error()));scf_handle_destroy(h);return (TYBS_R_FAILURE);}if ((namelen = scf_myname(h, NULL, 0)) == -1) {if (debug)UNEXPECTED_ERROR(__FILE__, __LINE__,"scf_myname() failed: %s",scf_strerror(scf_error()));scf_handle_destroy(h);return (TYBS_R_FAILURE);}if ((instance = tybs_mem_allocate(mctx, namelen + 1)) == NULL) { UNEXPECTED_ERROR(__FILE__, __LINE__,"ns_smf_get_instance memory ""allocation failed: %s",tybs_result_totext(TYBS_R_NOMEMORY));scf_handle_destroy(h);return (TYBS_R_FAILURE);}if (scf_myname(h, instance, namelen + 1) == -1) { if (debug)UNEXPECTED_ERROR(__FILE__, __LINE__,"scf_myname() failed: %s",scf_strerror(scf_error()));scf_handle_destroy(h);tybs_mem_free(mctx, instance);return (TYBS_R_FAILURE);}scf_handle_destroy(h);*ins_name = instance;return (TYBS_R_SUCCESS);}#endifintmain(int argc, char *argv[]) {tybs_result_t result;#ifdef HAVE_LIBSCFchar *instance = NULL;#endifstrlcat(version,#ifdef __DATE__"named version: BIND " VERSION " (" __DATE__ ")", #else"named version: BIND " VERSION,#endifsizeof(version));result = tybs_file_progname(*argv, program_name, sizeof(program_name)); if (result != TYBS_R_SUCCESS)ns_main_earlyfatal("program name too long");if (strcmp(program_name, "lwresd") == 0)ns_g_lwresdonly = TYBS_TRUE;tybs_assertion_setcallback(assertion_failed);tybs_error_setfatal(library_fatal_error);tybs_error_setunexpected(library_unexpected_error);ns_os_init(program_name);dns_result_register();dst_result_register();tybscc_result_register();parse_command_line(argc, argv);if (ns_g_chrootdir != NULL) {int len = strlen(ns_g_chrootdir);if (strncmp(ns_g_chrootdir, ns_g_conffile, len) == 0 &&(ns_g_conffile[len] == '/' || ns_g_conffile[len] == '\\')) ns_main_earlywarning("config filename (-c %s) contains ""chroot path (-t %s)",ns_g_conffile, ns_g_chrootdir);}result = tybs_mem_create(0, 0, &ns_g_mctx);if (result != TYBS_R_SUCCESS)ns_main_earlyfatal("tybs_mem_create() failed: %s",tybs_result_totext(result));tybs_mem_setname(ns_g_mctx, "main", NULL);setup();do {result = tybs_app_run();} else if (result != TYBS_R_SUCCESS) {UNEXPECTED_ERROR(__FILE__, __LINE__,"tybs_app_run(): %s",tybs_result_totext(result));result = TYBS_R_SUCCESS;}} while (result != TYBS_R_SUCCESS);#ifdef HAVE_LIBSCFif (ns_smf_want_disable == 1) {result = ns_smf_get_instance(&instance, 1, ns_g_mctx);if (result == TYBS_R_SUCCESS && instance != NULL) { if (smf_disable_instance(instance, 0) != 0)UNEXPECTED_ERROR(__FILE__, __LINE__,"smf_disable_instance() ""failed for %s : %s",instance,scf_strerror(scf_error()));}if (instance != NULL)tybs_mem_free(ns_g_mctx, instance);}#endif /* HAVE_LIBSCF */cleanup();if (want_stats) {tybs_mem_stats(ns_g_mctx, stdout);tybs_mutex_stats(stdout);}if (ns_g_memstatistics && memstats != NULL) {FILE *fp = NULL;result = tybs_stdio_open(memstats, "w", &fp);tybs_mutex_stats(fp);tybs_stdio_close(fp);}}tybs_mem_destroy(&ns_g_mctx);tybs_mem_checkdestroyed(stderr);ns_main_setmemstats(NULL);tybs_app_finish();ns_os_closedevnull();ns_os_shutdown();return (0);}#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS #include ""#include <>#include <>#ifdef PHP_WIN32#include "win32/"#include "win32/"#include "win32/"#include <>#elif defined(NETWARE)#include <sys/>#ifdef USE_WINSOCK#include <>#endif#endif#if HAVE_SYS_TIME_H#include <sys/>#endif#endif#if HAVE_SIGNAL_H#include <>#endif#if HAVE_SETLOCALE#include <>#endif#include ""#include ""#include ""#include ""#include ""#include ""#include "ext/standard/" #include ""#include "ext/standard/" #ifdef PHP_WIN32#include <>#include "win32/"#include "ext/standard/" #endif#include ""#include "Zend/"#if PHP_SIGCHILD#include <sys/>#include <sys/>#endif#include ""#include ""#include ""#include ""#include ""#include ""#include ""#include ""#include ""#include ""#include ""/* }}} */#ifndef ZTSphp_core_globals core_globals;#elsePHPAPI int core_globals_id;#endif#define SAFE_FILENAME(f) ((f)?(f):"-") /* {{{ PHP_INI_MH*/static PHP_INI_MH(OnSetPrecision){int i = atoi(new_value);if (i >= 0) {EG(precision) = i;return SUCCESS;} else {return FAILURE;}}static PHP_INI_MH(OnChangeMemoryLimit) {if (new_value) {PG(memory_limit) = 1<<30; /* effectively, no limit */ }return zend_set_memory_limit(PG(memory_limit));}static void php_disable_functions(TSRMLS_D){char *s = NULL, *e;if (!*(INI_STR("disable_functions"))) {return;}e = PG(disable_functions) = strdup(INI_STR("disable_functions"));while (*e) {switch (*e) {case ' ':case ',':if (s) {*e = '\0';zend_disable_function(s, e-s TSRMLS_CC);s = NULL;}break;default:if (!s) {s = e;}break;}e++;}if (s) {}static void php_disable_classes(TSRMLS_D){char *s = NULL, *e;if (!*(INI_STR("disable_classes"))) {return;}e = PG(disable_classes) = strdup(INI_STR("disable_classes"));while (*e) {switch (*e) {case ' ':case ',':if (s) {*e = '\0';zend_disable_class(s, e-s TSRMLS_CC);s = NULL;}break;default:if (!s) {s = e;}break;}e++;}if (s) {zend_disable_class(s, e-s TSRMLS_CC);}}EG(timeout_seconds) = atoi(new_value);if (stage==PHP_INI_STAGE_STARTUP) {/* Don't set a timeout on startup, only per-request */return SUCCESS;}zend_unset_timeout(TSRMLS_C);zend_set_timeout(EG(timeout_seconds));return SUCCESS;}static int php_get_display_errors_mode(char *value, int value_length){int mode;if (!value) {return PHP_DISPLAY_ERRORS_STDOUT;}if (value_length == 2 && !strcasecmp("on", value)) {mode = PHP_DISPLAY_ERRORS_STDOUT;} else if (value_length == 3 && !strcasecmp("yes", value)) {mode = PHP_DISPLAY_ERRORS_STDOUT;} else if (value_length == 4 && !strcasecmp("true", value)) {mode = PHP_DISPLAY_ERRORS_STDOUT;} else if (value_length == 6 && !strcasecmp(value, "stderr")) {mode = PHP_DISPLAY_ERRORS_STDERR;} else if (value_length == 6 && !strcasecmp(value, "stdout")) {mode = PHP_DISPLAY_ERRORS_STDOUT;} else {mode = atoi(value);if (mode && mode != PHP_DISPLAY_ERRORS_STDOUT && mode != PHP_DISPLAY_ERRORS_STDERR) { mode = PHP_DISPLAY_ERRORS_STDOUT;}}static PHP_INI_MH(OnUpdateDisplayErrors){PG(display_errors) = (zend_bool) php_get_display_errors_mode(new_value, new_value_length);return SUCCESS;}static PHP_INI_DISP(display_errors_mode){int mode, tmp_value_length, cgi_or_cli;char *tmp_value;TSRMLS_FETCH();if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {tmp_value = (ini_entry->orig_value ? ini_entry->orig_value : NULL );tmp_value_length = ini_entry->orig_value_length;} else if (ini_entry->value) {tmp_value = ini_entry->value;tmp_value_length = ini_entry->value_length;} else {tmp_value = NULL;tmp_value_length = 0;}mode = php_get_display_errors_mode(tmp_value, tmp_value_length);cgi_or_cli = (!strcmp, "cli") || !strcmp, "cgi"));switch (mode) {case PHP_DISPLAY_ERRORS_STDERR:if (cgi_or_cli ) {PUTS("STDERR");} else {PUTS("On");case PHP_DISPLAY_ERRORS_STDOUT:if (cgi_or_cli ) {PUTS("STDOUT");} else {PUTS("On");}break;default:PUTS("Off");break;}}static PHP_INI_MH(OnUpdateErrorLog){/* Only do the safemode/open_basedir check at runtime */if ((stage == PHP_INI_STAGE_RUNTIME || stage == PHP_INI_STAGE_HTACCESS) && strcmp(new_value, "syslog")) {if (PG(safe_mode) && (!php_checkuid(new_value, NULL, CHECKUID_CHECK_FILE_AND_DIR))) { return FAILURE;}if (PG(open_basedir) && php_check_open_basedir(new_value TSRMLS_CC)) {return FAILURE;}}OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);return SUCCESS;}static PHP_INI_MH(OnChangeMailForceExtra){return FAILURE;}return SUCCESS;}#ifndef PHP_SAFE_MODE_EXEC_DIR# define PHP_SAFE_MODE_EXEC_DIR ""#endif#if defined(PHP_PROG_SENDMAIL) && !defined(NETWARE)# define DEFAULT_SENDMAIL_PATH PHP_PROG_SENDMAIL " -t -i "#elif defined(PHP_WIN32)# define DEFAULT_SENDMAIL_PATH NULL#else# define DEFAULT_SENDMAIL_PATH "/usr/sbin/sendmail -t -i"#endifPHPAPI void php_log_err(char *log_message TSRMLS_DC){int fd = -1;char error_time_str[128];struct tm tmbuf;time_t error_time;/* Try to use the specified logging location. */if (PG(error_log) != NULL) {#ifdef HAVE_SYSLOG_Hif (!strcmp(PG(error_log), "syslog")) {php_syslog(LOG_NOTICE, "%.500s", log_message);return;}#endiffd = VCWD_OPEN_MODE(PG(error_log), O_CREAT | O_APPEND | O_WRONLY, 0644);if (fd != -1) {char *tmp;。
软件著作权-源代码范本
软件著作权-源代码范本注意事项:常见的源代码包含:C语言,VB,C++,JAVA,.NET等。
提交的代码必须是源代码的开头载入程序,第30页必须断开,第60页是软件的程序结尾,代码中不得出现与申请表内容不符合的日期,著作权人,软件名字等,不能出现开源代码,不能出现任何版权纠纷。
格式要求:一、源代码应提交前、后各连续30页,不足60页的,应当全部提交。
二、源代码页眉应标注软件的名称和版本号,应当与申请表中名称完全一致,页眉右上应标注页码,源代码每页不少于50行。
范例如下:#include <tybs/commandline.h>#include <tybs/dir.h>#include <tybs/entropy.h>#include <tybs/file.h>#include <tybs/hash.h>#include <tybs/os.h>#include <tybs/platform.h>#include <tybs/resource.h>#include <tybs/stdio.h>#include <tybs/string.h>#include <tybs/task.h>#include <tybs/timer.h>#include <tybs/util.h>#include <tybscc/result.h>#include <dns/dispatch.h>#include <dns/name.h>#include <dns/result.h>#include <dns/view.h>#include <dst/result.h>#define NS_MAIN 1#include <named/ns_smf_globals.h>#endif#ifdef DLZ#include <dlz/dlz_drivers.h>#endifstatic tybs_boolean_t want_stats = TYBS_FALSE;static char program_name[TYBS_DIR_NAMEMAX] = "named"; static char absolute_conffile[TYBS_DIR_PATHMAX];static char saved_command_line[512];static char version[512];static unsigned int maxsocks = 0;voidns_main_earlywarning(const char *format, ...) {va_list args;va_start(args, format);if (ns_g_lctx != NULL) {tybs_log_vwrite(ns_g_lctx, NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN, TYBS_LOG_W ARNING,format, args);} else {fprintf(stderr, "%s: ", program_name);vfprintf(stderr, format, args);fprintf(stderr, "\n");fflush(stderr);}va_end(args);}Void ns_main_earlyfatal(const char *format, ...) {va_list args;if (ns_g_lctx != NULL) {tybs_log_vwrite(ns_g_lctx, NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN, TYBS_LOG_CRITICAL,format, args);tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN, TYBS_LOG_CRITICAL,"exiting (due to early fatal error)");} else {fprintf(stderr, "%s: ", program_name);vfprintf(stderr, format, args);fprintf(stderr, "\n");fflush(stderr);}va_end(args);exit(1);}static voidassertion_failed(const char *file, int line, tybs_assertiontype_t type,const char *cond){if (ns_g_lctx != NULL) {tybs_assertion_setcallback(NULL);tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN, TYBS_LOG_CRITICAL,"%s:%d: %s(%s) failed", file, line,tybs_assertion_typetotext(type), cond);tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN, TYBS_LOG_CRITICAL,"exiting (due to assertion failure)");} else {fprintf(stderr, "%s:%d: %s(%s) failed\n",file, line, tybs_assertion_typetotext(type), cond);fflush(stderr);}if (ns_g_coreok)abort();exit(1);}static voidlibrary_fatal_error(const char *file, int line, const char *format,va_list args) TYBS_FORMAT_PRINTF(3, 0);static voidlibrary_fatal_error(const char *file, int line, const char *format,va_list args){if (ns_g_lctx != NULL) {tybs_error_setfatal(NULL);tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN, TYBS_LOG_CRITICAL,tybs_log_vwrite(ns_g_lctx, NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN, TYBS_LOG_CRITICAL,format, args);tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN, TYBS_LOG_CRITICAL,"exiting (due to fatal error in library)");} else {fprintf(stderr, "%s:%d: fatal error: ", file, line);vfprintf(stderr, format, args);fprintf(stderr, "\n");fflush(stderr);}if (ns_g_coreok)abort();exit(1);}static voidlibrary_unexpected_error(const char *file, int line, const char *format,va_list args) TYBS_FORMAT_PRINTF(3, 0);static voidlibrary_unexpected_error(const char *file, int line, const char *format,va_list args){if (ns_g_lctx != NULL) {tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN, TYBS_LOG_ERROR,"%s:%d: unexpected error:", file, line);tybs_log_vwrite(ns_g_lctx, NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN, TYBS_LOG_ERROR,format, args);} else {fprintf(stderr, "%s:%d: fatal error: ", file, line);vfprintf(stderr, format, args);fprintf(stderr, "\n");fflush(stderr);}}static voidlwresd_usage(void) {fprintf(stderr,"usage: lwresd [-4|-6] [-c conffile | -C resolvconffile] ""[-d debuglevel]\n"" [-f|-g] [-n number_of_cpus] [-p port] ""[-P listen-port] [-s]\n"" [-t chrootdir] [-u username] [-i pidfile]\n"" [-m {usage|trace|record|size|mctx}]\n");}static voidusage(void) {lwresd_usage();return;}fprintf(stderr,"usage: named [-4|-6] [-c conffile] [-d debuglevel] ""[-f|-g] [-n number_of_cpus]\n"" [-p port] [-s] [-t chrootdir] [-u username]\n"" [-m {usage|trace|record|size|mctx}]\n");}static voidsave_command_line(int argc, char *argv[]) {int i;char *src;char *dst;char *eob;const char truncated[] = "...";tybs_boolean_t quoted = TYBS_FALSE;dst = saved_command_line;eob = saved_command_line + sizeof(saved_command_line);for (i = 1; i < argc && dst < eob; i++) {*dst++ = ' ';src = argv[i];while (*src != '\0' && dst < eob) {if (quoted || isalnum(*src & 0xff) ||*src == '-' || *src == '_' ||*src == '.' || *src == '/') {*dst++ = *src++;quoted = TYBS_FALSE;} else {*dst++ = '\\';quoted = TYBS_TRUE;}}}INSIST(sizeof(saved_command_line) >= sizeof(truncated));if (dst == eob)strcpy(eob - sizeof(truncated), truncated);else*dst = '\0';}static intparse_int(char *arg, const char *desc) {char *endp;int tmp;long int ltmp;ltmp = strtol(arg, &endp, 10);tmp = (int) ltmp;if (*endp != '\0')ns_main_earlyfatal("%s '%s' must be numeric", desc, arg);ns_main_earlyfatal("%s '%s' out of range", desc, arg);return (tmp);}static struct flag_def {const char *name;unsigned int value;} mem_debug_flags[] = {{ "trace", TYBS_MEM_DEBUGTRACE },{ "record", TYBS_MEM_DEBUGRECORD },{ "usage", TYBS_MEM_DEBUGUSAGE },{ "size", TYBS_MEM_DEBUGSIZE },{ "mctx", TYBS_MEM_DEBUGCTX },{ NULL, 0 }};static voidset_flags(const char *arg, struct flag_def *defs, unsigned int *ret) { for (;;) {const struct flag_def *def;const char *end = strchr(arg, ',');int arglen;if (end == NULL)end = arg + strlen(arg);arglen = end - arg;for (def = defs; def->name != NULL; def++) {if (arglen == (int)strlen(def->name) &&memcmp(arg, def->name, arglen) == 0) {*ret |= def->value;goto found;}}ns_main_earlyfatal("unrecognized flag '%.*s'", arglen, arg);found:if (*end == '\0')break;arg = end + 1;}}static voidparse_command_line(int argc, char *argv[]) {int ch;int port;tybs_boolean_t disable6 = TYBS_FALSE;tybs_boolean_t disable4 = TYBS_FALSE;save_command_line(argc, argv);tybs_commandline_errprint = TYBS_FALSE;while ((ch = tybs_commandline_parse(argc, argv,"46c:C:d:fgi:lm:n:N:p:P:""sS:t:T:u:vVx:")) != -1) {switch (ch) {if (disable4)ns_main_earlyfatal("cannot specify -4 and -6");if (tybs_net_probeipv4() != TYBS_R_SUCCESS)ns_main_earlyfatal("IPv4 not supported by OS");tybs_net_disableipv6();disable6 = TYBS_TRUE;break;case '6':if (disable6)ns_main_earlyfatal("cannot specify -4 and -6");if (tybs_net_probeipv6() != TYBS_R_SUCCESS)ns_main_earlyfatal("IPv6 not supported by OS");tybs_net_disableipv4();disable4 = TYBS_TRUE;break;case 'c':ns_g_conffile = tybs_commandline_argument;lwresd_g_conffile = tybs_commandline_argument;if (lwresd_g_useresolvconf)ns_main_earlyfatal("cannot specify -c and -C");ns_g_conffileset = TYBS_TRUE;break;case 'C':lwresd_g_resolvconffile = tybs_commandline_argument;if (ns_g_conffileset)ns_main_earlyfatal("cannot specify -c and -C");lwresd_g_useresolvconf = TYBS_TRUE;break;case 'd':ns_g_debuglevel = parse_int(tybs_commandline_argument,"debug level");break;case 'f':ns_g_foreground = TYBS_TRUE;break;case 'g':ns_g_foreground = TYBS_TRUE;ns_g_logstderr = TYBS_TRUE;break;/* XXXBEW -i should be removed */case 'i':lwresd_g_defaultpidfile = tybs_commandline_argument;break;case 'l':ns_g_lwresdonly = TYBS_TRUE;break;case 'm':set_flags(tybs_commandline_argument, mem_debug_flags, &tybs_mem_debugging);case 'N': /* Deprecated. */case 'n':ns_g_cpus = parse_int(tybs_commandline_argument,"number of cpus");if (ns_g_cpus == 0)ns_g_cpus = 1;break;case 'p':port = parse_int(tybs_commandline_argument, "port");if (port < 1 || port > 65535)ns_main_earlyfatal("port '%s' out of range",tybs_commandline_argument);ns_g_port = port;break;/* XXXBEW Should -P be removed? */case 'P':port = parse_int(tybs_commandline_argument, "port");if (port < 1 || port > 65535)ns_main_earlyfatal("port '%s' out of range",tybs_commandline_argument);lwresd_g_listenport = port;break;case 's':want_stats = TYBS_TRUE;break;case 'S':maxsocks = parse_int(tybs_commandline_argument,"max number of sockets");break;case 't':ns_g_chrootdir = tybs_commandline_argument;break;case 'T':if (strcmp(tybs_commandline_argument, "clienttest") == 0) ns_g_clienttest = TYBS_TRUE;elsefprintf(stderr, "unknown -T flag '%s\n",tybs_commandline_argument);break;case 'u':ns_g_username = tybs_commandline_argument;break;case 'v':printf("BIND %s\n", ns_g_version);exit(0);case 'V':printf("BIND %s built with %s\n", ns_g_version,ns_g_configargs);exit(0);usage();if (tybs_commandline_option == '?')exit(0);ns_main_earlyfatal("unknown option '-%c'",tybs_commandline_option);default:ns_main_earlyfatal("parsing options returned %d", ch);}}argc -= tybs_commandline_index;argv += tybs_commandline_index;if (argc > 0) {usage();ns_main_earlyfatal("extra command line arguments");}}static tybs_result_tcreate_managers(void) {tybs_result_t result;unsigned int socks;#ifdef TYBS_PLATFORM_USETHREADSunsigned int cpus_detected;#endif#ifdef TYBS_PLATFORM_USETHREADScpus_detected = tybs_os_ncpus();if (ns_g_cpus == 0)ns_g_cpus = cpus_detected;tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER, TYBS_LOG_INFO, "found %u CPU%s, using %u worker thread%s",cpus_detected, cpus_detected == 1 ? "" : "s",ns_g_cpus, ns_g_cpus == 1 ? "" : "s");#elsens_g_cpus = 1;#endifresult = tybs_taskmgr_create(ns_g_mctx, ns_g_cpus, 0, &ns_g_taskmgr);if (result != TYBS_R_SUCCESS) {UNEXPECTED_ERROR(__FILE__, __LINE__,"tybs_taskmgr_create() failed: %s",tybs_result_totext(result));return (TYBS_R_UNEXPECTED);}result = tybs_timermgr_create(ns_g_mctx, &ns_g_timermgr);if (result != TYBS_R_SUCCESS) {UNEXPECTED_ERROR(__FILE__, __LINE__,"tybs_timermgr_create() failed: %s",tybs_result_totext(result));return (TYBS_R_UNEXPECTED);}result = tybs_socketmgr_create2(ns_g_mctx, &ns_g_socketmgr, maxsocks);UNEXPECTED_ERROR(__FILE__, __LINE__,"tybs_socketmgr_create() failed: %s",tybs_result_totext(result));return (TYBS_R_UNEXPECTED);}result = tybs_socketmgr_getmaxsockets(ns_g_socketmgr, &socks);if (result == TYBS_R_SUCCESS) {tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_SERVER,TYBS_LOG_INFO, "using up to %u sockets", socks);}result = tybs_entropy_create(ns_g_mctx, &ns_g_entropy);if (result != TYBS_R_SUCCESS) {UNEXPECTED_ERROR(__FILE__, __LINE__,"tybs_entropy_create() failed: %s",tybs_result_totext(result));return (TYBS_R_UNEXPECTED);}result = tybs_hash_create(ns_g_mctx, ns_g_entropy, DNS_NAME_MAXWIRE);if (result != TYBS_R_SUCCESS) {UNEXPECTED_ERROR(__FILE__, __LINE__,"tybs_hash_create() failed: %s",tybs_result_totext(result));return (TYBS_R_UNEXPECTED);}return (TYBS_R_SUCCESS);}static voiddestroy_managers(void) {ns_lwresd_shutdown();tybs_entropy_detach(&ns_g_entropy);if (ns_g_fallbackentropy != NULL)tybs_entropy_detach(&ns_g_fallbackentropy);tybs_taskmgr_destroy(&ns_g_taskmgr);tybs_timermgr_destroy(&ns_g_timermgr);tybs_socketmgr_destroy(&ns_g_socketmgr);tybs_hash_destroy();}static voidsetup(void) {tybs_result_t result;#ifdef HA VE_LIBSCFchar *instance = NULL;#endifns_os_inituserinfo(ns_g_username);ns_os_tzset();ns_os_opendevnull();#ifdef HA VE_LIBSCFresult = ns_smf_get_instance(&instance, 0, ns_g_mctx);ns_smf_got_instance = 1;elsens_smf_got_instance = 0;if (instance != NULL)tybs_mem_free(ns_g_mctx, instance);#endif /* HA VE_LIBSCF */#ifdef PA TH_RANDOMDEVif (ns_g_chrootdir != NULL) {result = tybs_entropy_create(ns_g_mctx, &ns_g_fallbackentropy);if (result != TYBS_R_SUCCESS)ns_main_earlyfatal("tybs_entropy_create() failed: %s",tybs_result_totext(result));result = tybs_entropy_createfilesource(ns_g_fallbackentropy,PA TH_RANDOMDEV);if (result != TYBS_R_SUCCESS) {ns_main_earlywarning("could not open pre-chroot ""entropy source %s: %s",PA TH_RANDOMDEV,tybs_result_totext(result));tybs_entropy_detach(&ns_g_fallbackentropy);}}#endifns_os_chroot(ns_g_chrootdir);ns_os_minprivs();result = ns_log_init(TYBS_TF(ns_g_username != NULL));if (result != TYBS_R_SUCCESS)ns_main_earlyfatal("ns_log_init() failed: %s",tybs_result_totext(result));if (!ns_g_foreground)ns_os_daemonize();result = tybs_app_start();if (result != TYBS_R_SUCCESS)ns_main_earlyfatal("tybs_app_start() failed: %s",tybs_result_totext(result));tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN, TYBS_LOG_NOTICE, "starting BIND %s%s", ns_g_version,saved_command_line);tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN, TYBS_LOG_NOTICE, "built with %s", ns_g_configargs);(void)tybs_resource_getlimit(tybs_resource_stacksize,&ns_g_initstacksize);(void)tybs_resource_getlimit(tybs_resource_datasize,&ns_g_initdatasize);(void)tybs_resource_getlimit(tybs_resource_coresize,&ns_g_initcoresize);(void)tybs_resource_getlimit(tybs_resource_openfiles,&ns_g_initopenfiles);if (! tybs_file_isabsolute(ns_g_conffile)) {absolute_conffile,sizeof(absolute_conffile));if (result != TYBS_R_SUCCESS)ns_main_earlyfatal("could not construct absolute path of ""configuration file: %s",tybs_result_totext(result));ns_g_conffile = absolute_conffile;}result = tybs_time_now(&ns_g_boottime);if (result != TYBS_R_SUCCESS)ns_main_earlyfatal("tybs_time_now() failed: %s",tybs_result_totext(result));result = create_managers();if (result != TYBS_R_SUCCESS)ns_main_earlyfatal("create_managers() failed: %s",tybs_result_totext(result));ns_builtin_init();#ifdef DLZresult = dlz_drivers_init();if (result != TYBS_R_SUCCESS)ns_main_earlyfatal("dlz_drivers_init() failed: %s",tybs_result_totext(result));#endifns_server_create(ns_g_mctx, &ns_g_server);}static voidcleanup(void) {destroy_managers();ns_server_destroy(&ns_g_server);ns_builtin_deinit();#ifdef DLZdlz_drivers_clear();#endifdns_name_destroy();tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN, TYBS_LOG_NOTICE, "exiting");ns_log_shutdown();}static char *memstats = NULL;voidns_main_setmemstats(const char *filename) {if (memstats != NULL) {free(memstats);memstats = NULL;}if (filename == NULL)return;memstats = malloc(strlen(filename) + 1);if (memstats)}#ifdef HA VE_LIBSCFtybs_result_tns_smf_get_instance(char **ins_name, int debug, tybs_mem_t *mctx) { scf_handle_t *h = NULL;int namelen;char *instance;REQUIRE(ins_name != NULL && *ins_name == NULL);if ((h = scf_handle_create(SCF_VERSION)) == NULL) {if (debug)UNEXPECTED_ERROR(__FILE__, __LINE__,"scf_handle_create() failed: %s",scf_strerror(scf_error()));return (TYBS_R_FAILURE);}if (scf_handle_bind(h) == -1) {if (debug)UNEXPECTED_ERROR(__FILE__, __LINE__,"scf_handle_bind() failed: %s",scf_strerror(scf_error()));scf_handle_destroy(h);return (TYBS_R_FAILURE);}if ((namelen = scf_myname(h, NULL, 0)) == -1) {if (debug)UNEXPECTED_ERROR(__FILE__, __LINE__,"scf_myname() failed: %s",scf_strerror(scf_error()));scf_handle_destroy(h);return (TYBS_R_FAILURE);}if ((instance = tybs_mem_allocate(mctx, namelen + 1)) == NULL) { UNEXPECTED_ERROR(__FILE__, __LINE__,"ns_smf_get_instance memory ""allocation failed: %s",tybs_result_totext(TYBS_R_NOMEMORY));scf_handle_destroy(h);return (TYBS_R_FAILURE);}if (scf_myname(h, instance, namelen + 1) == -1) {if (debug)UNEXPECTED_ERROR(__FILE__, __LINE__,"scf_myname() failed: %s",scf_strerror(scf_error()));scf_handle_destroy(h);tybs_mem_free(mctx, instance);return (TYBS_R_FAILURE);}scf_handle_destroy(h);return (TYBS_R_SUCCESS);}#endifintmain(int argc, char *argv[]) {tybs_result_t result;#ifdef HA VE_LIBSCFchar *instance = NULL;#endifstrlcat(version,#ifdef __DATE__"named version: BIND " VERSION " (" __DA TE__ ")",#else"named version: BIND " VERSION,#endifsizeof(version));result = tybs_file_progname(*argv, program_name, sizeof(program_name));if (result != TYBS_R_SUCCESS)ns_main_earlyfatal("program name too long");if (strcmp(program_name, "lwresd") == 0)ns_g_lwresdonly = TYBS_TRUE;tybs_assertion_setcallback(assertion_failed);tybs_error_setfatal(library_fatal_error);tybs_error_setunexpected(library_unexpected_error);ns_os_init(program_name);dns_result_register();dst_result_register();tybscc_result_register();parse_command_line(argc, argv);if (ns_g_chrootdir != NULL) {int len = strlen(ns_g_chrootdir);if (strncmp(ns_g_chrootdir, ns_g_conffile, len) == 0 &&(ns_g_conffile[len] == '/' || ns_g_conffile[len] == '\\'))ns_main_earlywarning("config filename (-c %s) contains ""chroot path (-t %s)",ns_g_conffile, ns_g_chrootdir);}result = tybs_mem_create(0, 0, &ns_g_mctx);if (result != TYBS_R_SUCCESS)ns_main_earlyfatal("tybs_mem_create() failed: %s",tybs_result_totext(result));tybs_mem_setname(ns_g_mctx, "main", NULL);setup();do {result = tybs_app_run();if (result == TYBS_R_RELOAD) {ns_server_reloadwanted(ns_g_server);} else if (result != TYBS_R_SUCCESS) {UNEXPECTED_ERROR(__FILE__, __LINE__,tybs_result_totext(result));result = TYBS_R_SUCCESS;}} while (result != TYBS_R_SUCCESS);#ifdef HA VE_LIBSCFif (ns_smf_want_disable == 1) {result = ns_smf_get_instance(&instance, 1, ns_g_mctx);if (result == TYBS_R_SUCCESS && instance != NULL) { if (smf_disable_instance(instance, 0) != 0)UNEXPECTED_ERROR(__FILE__, __LINE__,"smf_disable_instance() ""failed for %s : %s",instance,scf_strerror(scf_error()));}if (instance != NULL)tybs_mem_free(ns_g_mctx, instance);}#endif /* HA VE_LIBSCF */cleanup();if (want_stats) {tybs_mem_stats(ns_g_mctx, stdout);tybs_mutex_stats(stdout);}if (ns_g_memstatistics && memstats != NULL) {FILE *fp = NULL;result = tybs_stdio_open(memstats, "w", &fp);if (result == TYBS_R_SUCCESS) {tybs_mem_stats(ns_g_mctx, fp);tybs_mutex_stats(fp);tybs_stdio_close(fp);}}tybs_mem_destroy(&ns_g_mctx);tybs_mem_checkdestroyed(stderr);ns_main_setmemstats(NULL);tybs_app_finish();ns_os_closedevnull();ns_os_shutdown();return (0);}#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS#include "php.h"#include <stdio.h>#include <fcntl.h>#ifdef PHP_WIN32#include "win32/time.h"#include "win32/signal.h"#include "win32/php_win32_globals.h"#elif defined(NETW ARE)#include <sys/timeval.h>#ifdef USE_WINSOCK#include <novsock2.h>#endif#endif#if HA VE_SYS_TIME_H#include <sys/time.h>#endif#if HA VE_UNISTD_H#include <unistd.h>#endif#if HA VE_SIGNAL_H#include <signal.h>#endif#if HA VE_SETLOCALE#include <locale.h>#endif#include "zend.h"#include "zend_extensions.h"#include "php_ini.h"#include "php_globals.h"#include "php_main.h"#include "fopen_wrappers.h"#include "ext/standard/php_standard.h" #include "php_variables.h"#include "ext/standard/credits.h"#ifdef PHP_WIN32#include <io.h>#include "win32/php_registry.h"#include "ext/standard/flock_compat.h" #endif#include "php_syslog.h"#include "Zend/zend_exceptions.h"#if PHP_SIGCHILD#include <sys/types.h>#include <sys/wait.h>#endif#include "zend_compile.h"#include "zend_execute.h"#include "zend_highlight.h"#include "zend_indent.h"#include "zend_extensions.h"#include "zend_ini.h"#include "php_content_types.h"#include "php_ticks.h"#include "php_logos.h"#include "php_streams.h"#include "php_open_temporary_file.h"#include "rfc1867.h"/* }}} */#ifndef ZTSphp_core_globals core_globals;#elsePHPAPI int core_globals_id;#endif#define SAFE_FILENAME(f) ((f)?(f):"-")/* {{{ PHP_INI_MH*/static PHP_INI_MH(OnSetPrecision){int i = atoi(new_value);if (i >= 0) {EG(precision) = i;return SUCCESS;} else {return FAILURE;}}static PHP_INI_MH(OnChangeMemoryLimit){if (new_value) {PG(memory_limit) = zend_atoi(new_value, new_value_length);} else {PG(memory_limit) = 1<<30; /* effectively, no limit */ }return zend_set_memory_limit(PG(memory_limit));}static void php_disable_functions(TSRMLS_D){char *s = NULL, *e;if (!*(INI_STR("disable_functions"))) {return;}e = PG(disable_functions) = strdup(INI_STR("disable_functions"));while (*e) {switch (*e) {case ' ':case ',':if (s) {*e = '\0';zend_disable_function(s, e-s TSRMLS_CC);s = NULL;}break;default:if (!s) {s = e;break;}e++;}if (s) {zend_disable_function(s, e-s TSRMLS_CC);}}static void php_disable_classes(TSRMLS_D){char *s = NULL, *e;if (!*(INI_STR("disable_classes"))) {return;}e = PG(disable_classes) = strdup(INI_STR("disable_classes"));while (*e) {switch (*e) {case ' ':case ',':if (s) {*e = '\0';zend_disable_class(s, e-s TSRMLS_CC);s = NULL;}break;default:if (!s) {s = e;}break;}e++;}if (s) {zend_disable_class(s, e-s TSRMLS_CC);}}static PHP_INI_MH(OnUpdateTimeout){EG(timeout_seconds) = atoi(new_value);if (stage==PHP_INI_STAGE_STARTUP) {/* Don't set a timeout on startup, only per-request */return SUCCESS;}zend_unset_timeout(TSRMLS_C);zend_set_timeout(EG(timeout_seconds));return SUCCESS;}static int php_get_display_errors_mode(char *value, int value_length)int mode;if (!value) {return PHP_DISPLAY_ERRORS_STDOUT;}if (value_length == 2 && !strcasecmp("on", value)) {mode = PHP_DISPLAY_ERRORS_STDOUT;} else if (value_length == 3 && !strcasecmp("yes", value)) {mode = PHP_DISPLAY_ERRORS_STDOUT;} else if (value_length == 4 && !strcasecmp("true", value)) {mode = PHP_DISPLAY_ERRORS_STDOUT;} else if (value_length == 6 && !strcasecmp(value, "stderr")) {mode = PHP_DISPLAY_ERRORS_STDERR;} else if (value_length == 6 && !strcasecmp(value, "stdout")) {mode = PHP_DISPLAY_ERRORS_STDOUT;} else {mode = atoi(value);if (mode && mode != PHP_DISPLAY_ERRORS_STDOUT && mode != PHP_DISPLAY_ERRORS_STDERR) {mode = PHP_DISPLAY_ERRORS_STDOUT;}}return mode;}static PHP_INI_MH(OnUpdateDisplayErrors){PG(display_errors) = (zend_bool) php_get_display_errors_mode(new_value, new_value_length);return SUCCESS;}static PHP_INI_DISP(display_errors_mode){int mode, tmp_value_length, cgi_or_cli;char *tmp_value;TSRMLS_FETCH();if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {tmp_value = (ini_entry->orig_value ? ini_entry->orig_value : NULL );tmp_value_length = ini_entry->orig_value_length;} else if (ini_entry->value) {tmp_value = ini_entry->value;tmp_value_length = ini_entry->value_length;} else {tmp_value = NULL;tmp_value_length = 0;}mode = php_get_display_errors_mode(tmp_value, tmp_value_length);cgi_or_cli = (!strcmp(sapi_, "cli") || !strcmp(sapi_, "cgi"));switch (mode) {case PHP_DISPLAY_ERRORS_STDERR:if (cgi_or_cli ) {PUTS("STDERR");PUTS("On");}break;case PHP_DISPLAY_ERRORS_STDOUT:if (cgi_or_cli ) {PUTS("STDOUT");} else {PUTS("On");}break;default:PUTS("Off");break;}}static PHP_INI_MH(OnUpdateErrorLog){/* Only do the safemode/open_basedir check at runtime */if ((stage == PHP_INI_STAGE_RUNTIME || stage == PHP_INI_STAGE_HTACCESS) && strcmp(new_value, "syslog")) {if (PG(safe_mode) && (!php_checkuid(new_value, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {return FAILURE;}if (PG(open_basedir) && php_check_open_basedir(new_value TSRMLS_CC)) {return FAILURE;}}OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);return SUCCESS;}static PHP_INI_MH(OnChangeMailForceExtra){/* Don't allow changing it in htaccess */if (stage == PHP_INI_STAGE_HTACCESS) {return FAILURE;}return SUCCESS;}#ifndef PHP_SAFE_MODE_EXEC_DIR# define PHP_SAFE_MODE_EXEC_DIR ""#endif#if defined(PHP_PROG_SENDMAIL) && !defined(NETWARE)# define DEFAULT_SENDMAIL_PA TH PHP_PROG_SENDMAIL " -t -i "#elif defined(PHP_WIN32)# define DEFAULT_SENDMAIL_PA TH NULL#else# define DEFAULT_SENDMAIL_PA TH "/usr/sbin/sendmail -t -i"#endif。
申请软著python源代码文档
申请软著python源代码文档我国的软件知识产权保护制度逐渐完善,软件著作权作为软件知识产权的重要组成部分,对保护软件开发者的利益、推动软件产业发展、鼓励创新具有重要意义。
然而,随着互联网技术的飞速发展,网络环境下软件著作权的侵权现象屡禁不止,因此软件的著作权保护尤为重要。
Python作为一种高级程序设计语言,其广泛应用于各类软件开发中,对其源代码文档的著作权保护显得尤为重要。
本文将围绕申请软著Python源代码文档展开讨论,探讨在申请过程中应该注意的事项及具体流程。
一、Python源代码文档的保护对象Python源代码文档是指程序员通过Python语言编写的程序源代码及其相关文档。
Python源代码文档作为具有独创性和创作性的作品,符合软件著作权的基本要求,可以作为软件著作权的保护对象。
在申请软著Python源代码文档时,需要注意的是,该文档应当具有独立性和完整性,在构成上应当能够独立存在并发挥作用。
二、申请软著Python源代码文档的条件1. 独创性:Python源代码文档应当具有一定的独创性,即具有相对独立性和创作性。
在申请软著时,需要证明该文档具有一定的原创性,不属于他人已经拥有著作权的作品。
2. 完整性:Python源代码文档应当具有一定的完整性,即具有相对完整、独立的结构,并具备一定的功能。
3. 可复制性:Python源代码文档应当具有可复制性,即可以通过程序运行等方式进行复制、展示、传播或利用。
三、申请软著Python源代码文档的流程1. 准备材料:首先需要准备好软著申请表、Python源代码文档及其说明文档、作者唯一识别信息明等相关材料。
2. 登录软著申请系统:登录国家版权局软著申请系统,填写软著申请表,并上传Python源代码文档及其相关材料。
3. 审查与备案:国家版权局在接受软著申请后,将对申请材料进行审查,如果符合著作权法和软件著作权保护的相关规定,将予以受理并备案。
四、申请软著Python源代码文档的注意事项1. 注意文档的独立性和完整性:在申请软著Python源代码文档时,需要特别注意文档的独立性和完整性,确保其能够独立存在并发挥作用。
软著申请 源代码不加注释
软著申请源代码不加注释
在软件开发领域,源代码是一种包含程序逻辑和算法的文本文件。
它是开发人员编写的,用于创建计算机程序。
源代码通常使用特定的编程语言编写,例如C++、Java或Python。
源代码是程序的基础构建块,它描述了程序执行的步骤和逻辑。
然而,在编写源代码时,有些开发者可能会选择不加注释。
注释是一种解释源代码目的和功能的文本,它提供了对代码的说明和帮助。
不加注释的源代码可能会给其他开发者带来困惑。
没有注释的代码可能更难理解和维护。
开发者可能需要花费更多的时间和精力来理解源代码的功能和目的。
不加注释的源代码还可能导致团队合作的问题。
如果多个开发者一起工作,没有注释的代码可能会导致误解和错误。
开发者可能会浪费时间试图理解代码的含义,而不是专注于解决问题。
在编写源代码时,加注释是一种良好的编程实践。
通过注释,开发者可以提供对代码目的、功能和实现的详细说明。
注释还可以帮助其他开发者更轻松地理解和维护代码。
然而,有些开发者选择不加注释的原因可能是为了保护代码的商业机密或遵守公司政策。
在这种情况下,开发者通常会使用其他方式来记录代码的目的和功能,例如在项目管理工具中创建任务或文档。
源代码不加注释可能会给开发者带来困惑,增加代码理解和维护的难度。
加注释是一种良好的编程实践,可以提高代码的可读性和可维护性。
在编写源代码时,加注释是一个值得考虑的选择。
软件著作权-源代码范本
软件著作权-源代码范本注意事项:常见的源代码包含:C语言,VB,C++,JAVA,.NET等。
提交的代码必须是源代码的开头载入程序,第30页必须断开,第60页是软件的程序结尾,代码中不得出现与申请表内容不符合的日期,著作权人,软件名字等,不能出现开源代码,不能出现任何版权纠纷。
格式要求:一、源代码应提交前、后各连续30页,不足60页的,应当全部提交。
二、源代码页眉应标注软件的名称和版本号,应当与申请表中名称完全一致,页眉右上应标注页码,源代码每页不少于50行。
范例如下:#include <tybs/commandline.h> #include <tybs/dir.h>#include <tybs/entropy.h>#include <tybs/file.h>#include <tybs/hash.h>#include <tybs/os.h>#include <tybs/platform.h>#include <tybs/resource.h>#include <tybs/stdio.h>#include <tybs/string.h>#include <tybs/task.h>#include <tybs/timer.h>#include <tybs/util.h>#include <tybscc/result.h>#include <dns/dispatch.h>#include <dns/name.h>#include <dns/result.h>#include <dns/view.h>#include <dst/result.h>#define NS_MAIN 1#include <named/ns_smf_globals.h>#endif#ifdef DLZ#include <dlz/dlz_drivers.h>#endifstatic tybs_boolean_t want_stats = TYBS_FALSE;static char program_name[TYBS_DIR_NAMEMAX] = "named"; static char absolute_conffile[TYBS_DIR_PATHMAX]; static char saved_command_line[512];static char version[512];static unsigned int maxsocks = 0;voidns_main_earlywarning(const char *format, ...) {va_list args;va_start(args, format);if (ns_g_lctx != NULL) {NS_LOGMODULE_MAIN, TYBS_LOG_WARNING,format, args);} else {fprintf(stderr, "%s: ", program_name);vfprintf(stderr, format, args);fprintf(stderr, "\n");fflush(stderr);}va_end(args);}Void ns_main_earlyfatal(const char *format, ...) { va_list args;va_start(args, format);if (ns_g_lctx != NULL) {tybs_log_vwrite(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN, TYBS_LOG_CRITICAL,format, args);NS_LOGMODULE_MAIN, TYBS_LOG_CRITICAL,"exiting (due to early fatal error)");} else {fprintf(stderr, "%s: ", program_name);vfprintf(stderr, format, args);fprintf(stderr, "\n");fflush(stderr);}va_end(args);exit(1);}static voidassertion_failed(const char *file, int line, tybs_assertiontype_t type,const char *cond){if (ns_g_lctx != NULL) {tybs_assertion_setcallback(NULL);NS_LOGMODULE_MAIN, TYBS_LOG_CRITICAL,"%s:%d: %s(%s) failed", file, line,tybs_assertion_typetotext(type), cond);tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN, TYBS_LOG_CRITICAL,"exiting (due to assertion failure)");} else {fprintf(stderr, "%s:%d: %s(%s) failed\n",file, line, tybs_assertion_typetotext(type), cond);fflush(stderr);}if (ns_g_coreok)abort();exit(1);}static voidlibrary_fatal_error(const char *file, int line, const char *format,va_list args) TYBS_FORMAT_PRINTF(3, 0);static voidlibrary_fatal_error(const char *file, int line, const char *format, va_list args){if (ns_g_lctx != NULL) {tybs_error_setfatal(NULL);tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN, TYBS_LOG_CRITICAL,"%s:%d: fatal error:", file, line);tybs_log_vwrite(ns_g_lctx, NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN, TYBS_LOG_CRITICAL,format, args);tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN, TYBS_LOG_CRITICAL,"exiting (due to fatal error in library)");} else {fprintf(stderr, "%s:%d: fatal error: ", file, line);vfprintf(stderr, format, args);fprintf(stderr, "\n");fflush(stderr);}if (ns_g_coreok)abort();exit(1);}static voidlibrary_unexpected_error(const char *file, int line, const char *format,va_list args) TYBS_FORMAT_PRINTF(3, 0);static voidlibrary_unexpected_error(const char *file, int line, const char *format,va_list args){if (ns_g_lctx != NULL) {tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN, TYBS_LOG_ERROR,"%s:%d: unexpected error:", file, line);tybs_log_vwrite(ns_g_lctx, NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN, TYBS_LOG_ERROR,format, args);} else {fprintf(stderr, "%s:%d: fatal error: ", file, line); vfprintf(stderr, format, args);fprintf(stderr, "\n");fflush(stderr);}}static voidlwresd_usage(void) {fprintf(stderr,"usage: lwresd [-4|-6] [-c conffile | -C resolvconffile] " "[-d debuglevel]\n""[-f|-g] [-n number_of_cpus] [-p port] ""[-P listen-port] [-s]\n""[-t chrootdir] [-u username] [-i pidfile]\n""[-m {usage|trace|record|size|mctx}]\n");}static voidusage(void) {if (ns_g_lwresdonly) {lwresd_usage();return;}fprintf(stderr,"usage: named [-4|-6] [-c conffile] [-d debuglevel] " "[-f|-g] [-n number_of_cpus]\n""[-p port] [-s] [-t chrootdir] [-u username]\n" "[-m {usage|trace|record|size|mctx}]\n");}static voidsave_command_line(int argc, char *argv[]) {int i;char *src;char *dst;char *eob;const char truncated[] = "...";tybs_boolean_t quoted = TYBS_FALSE;dst = saved_command_line;eob = saved_command_line + sizeof(saved_command_line); for (i = 1; i < argc && dst < eob; i++) {*dst++ = ' ';src = argv[i];while (*src != '\0' && dst < eob) {if (quoted || isalnum(*src & 0xff) ||*src == '-' || *src == '_' ||*src == '.' || *src == '/') {*dst++ = *src++;quoted = TYBS_FALSE;} else {*dst++ = '\\';quoted = TYBS_TRUE;}}}INSIST(sizeof(saved_command_line) >= sizeof(truncated)); if (dst == eob)strcpy(eob - sizeof(truncated), truncated);else*dst = '\0';}static intparse_int(char *arg, const char *desc) {char *endp;int tmp;long int ltmp;ltmp = strtol(arg, &endp, 10);tmp = (int) ltmp;if (*endp != '\0')ns_main_earlyfatal("%s '%s' must be numeric", desc, arg); if (tmp < 0 || tmp != ltmp)ns_main_earlyfatal("%s '%s' out of range", desc, arg); return (tmp);}static struct flag_def {const char *name;unsigned int value;} mem_debug_flags[] = {{ "trace", TYBS_MEM_DEBUGTRACE },{ "record", TYBS_MEM_DEBUGRECORD },{ "usage", TYBS_MEM_DEBUGUSAGE },{ "size", TYBS_MEM_DEBUGSIZE },{ "mctx", TYBS_MEM_DEBUGCTX },{ NULL, 0 }};static voidset_flags(const char *arg, struct flag_def *defs,unsigned int *ret) {for (;;) {const struct flag_def *def;const char *end = strchr(arg, ',');int arglen;if (end == NULL)end = arg + strlen(arg);arglen = end - arg;for (def = defs; def->name != NULL; def++) {if (arglen == (int)strlen(def->name) &&memcmp(arg, def->name, arglen) == 0) {*ret |= def->value;goto found;}}ns_main_earlyfatal("unrecognized flag '%.*s'", arglen, arg);found:if (*end == '\0')break;arg = end + 1;}}static voidparse_command_line(int argc, char *argv[]) {int ch;int port;tybs_boolean_t disable6 = TYBS_FALSE;tybs_boolean_t disable4 = TYBS_FALSE;save_command_line(argc, argv);tybs_commandline_errprint = TYBS_FALSE;while ((ch = tybs_commandline_parse(argc, argv, ":C:d:fgi:lm:n:N:p:P:""sS:t:T:u:vVx:")) != -1) {switch (ch) {case '4':if (disable4)if (tybs_net_probeipv4() != TYBS_R_SUCCESS)ns_main_earlyfatal("IPv4 not supported by OS"); tybs_net_disableipv6();disable6 = TYBS_TRUE;break;case '6':if (disable6)ns_main_earlyfatal("cannot specify -4 and -6"); if (tybs_net_probeipv6() != TYBS_R_SUCCESS)ns_main_earlyfatal("IPv6 not supported by OS"); tybs_net_disableipv4();disable4 = TYBS_TRUE;break;case 'c':ns_g_conffile = tybs_commandline_argument; lwresd_g_conffile = tybs_commandline_argument; if (lwresd_g_useresolvconf)ns_g_conffileset = TYBS_TRUE;break;case 'C':lwresd_g_resolvconffile = tybs_commandline_argument;if (ns_g_conffileset)ns_main_earlyfatal("cannot specify -c and -C");lwresd_g_useresolvconf = TYBS_TRUE;break;case 'd':ns_g_debuglevel = parse_int(tybs_commandline_argument, "debug level");break;case 'f':ns_g_foreground = TYBS_TRUE;break;case 'g':ns_g_foreground = TYBS_TRUE;ns_g_logstderr = TYBS_TRUE;break;/* XXXBEW -i should be removed */case 'i':lwresd_g_defaultpidfile = tybs_commandline_argument; break;case 'l':ns_g_lwresdonly = TYBS_TRUE;break;case 'm':set_flags(tybs_commandline_argument, mem_debug_flags, &tybs_mem_debugging);break;case 'N': /* Deprecated. */case 'n':ns_g_cpus = parse_int(tybs_commandline_argument, "number of cpus");if (ns_g_cpus == 0)ns_g_cpus = 1;break;case 'p':port = parse_int(tybs_commandline_argument, "port"); if (port < 1 || port > 65535)ns_main_earlyfatal("port '%s' out of range",tybs_commandline_argument);ns_g_port = port;break;/* XXXBEW Should -P be removed? */case 'P':port = parse_int(tybs_commandline_argument, "port"); if (port < 1 || port > 65535)ns_main_earlyfatal("port '%s' out of range",tybs_commandline_argument);lwresd_g_listenport = port;break;case 's':want_stats = TYBS_TRUE;break;case 'S':maxsocks = parse_int(tybs_commandline_argument,"max number of sockets");break;case 't':ns_g_chrootdir = tybs_commandline_argument;break;case 'T':if (strcmp(tybs_commandline_argument, "clienttest") == 0) ns_g_clienttest = TYBS_TRUE;elsefprintf(stderr, "unknown -T flag '%s\n",tybs_commandline_argument);break;case 'u':ns_g_username = tybs_commandline_argument;软件著作权-源代码范本break;case 'v':printf("BIND %s\n", ns_g_version);exit(0);case 'V':printf("BIND %s built with %s\n", ns_g_version,ns_g_configargs);exit(0);case '?':usage();if (tybs_commandline_option == '?')exit(0);ns_main_earlyfatal("unknown option '-%c'",tybs_commandline_option);default:ns_main_earlyfatal("parsing options returned %d", ch);}}argc -= tybs_commandline_index;argv += tybs_commandline_index;if (argc > 0) {usage();ns_main_earlyfatal("extra command line arguments"); }}static tybs_result_tcreate_managers(void) {tybs_result_t result;unsigned int socks;#ifdef TYBS_PLATFORM_USETHREADSunsigned int cpus_detected;#endif#ifdef TYBS_PLATFORM_USETHREADScpus_detected = tybs_os_ncpus();if (ns_g_cpus == 0)ns_g_cpus = cpus_detected;tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_SERVER,TYBS_LOG_INFO, "found %u CPU%s, using %u worker thread%s", cpus_detected, cpus_detected == 1 ? "" : "s",ns_g_cpus, ns_g_cpus == 1 ? "" : "s");#elsens_g_cpus = 1;#endifresult = tybs_taskmgr_create(ns_g_mctx, ns_g_cpus, 0,&ns_g_taskmgr);if (result != TYBS_R_SUCCESS) {UNEXPECTED_ERROR(__FILE__, __LINE__,"tybs_taskmgr_create() failed: %s",tybs_result_totext(result));return (TYBS_R_UNEXPECTED);}result = tybs_timermgr_create(ns_g_mctx, &ns_g_timermgr);if (result != TYBS_R_SUCCESS) {UNEXPECTED_ERROR(__FILE__, __LINE__,"tybs_timermgr_create() failed: %s",tybs_result_totext(result));return (TYBS_R_UNEXPECTED);}result = tybs_socketmgr_create2(ns_g_mctx, &ns_g_socketmgr, maxsocks);if (result != TYBS_R_SUCCESS) {UNEXPECTED_ERROR(__FILE__, __LINE__,"tybs_socketmgr_create() failed: %s",tybs_result_totext(result));return (TYBS_R_UNEXPECTED);}result = tybs_socketmgr_getmaxsockets(ns_g_socketmgr, &socks);if (result == TYBS_R_SUCCESS) {tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_SERVER,TYBS_LOG_INFO, "using up to %u sockets", socks);}result = tybs_entropy_create(ns_g_mctx, &ns_g_entropy);if (result != TYBS_R_SUCCESS) {UNEXPECTED_ERROR(__FILE__, __LINE__,"tybs_entropy_create() failed: %s",tybs_result_totext(result));return (TYBS_R_UNEXPECTED);}result = tybs_hash_create(ns_g_mctx, ns_g_entropy, DNS_NAME_MAXWIRE);if (result != TYBS_R_SUCCESS) {UNEXPECTED_ERROR(__FILE__, __LINE__,"tybs_hash_create() failed: %s",tybs_result_totext(result));return (TYBS_R_UNEXPECTED);}return (TYBS_R_SUCCESS);}static voiddestroy_managers(void) {ns_lwresd_shutdown();tybs_entropy_detach(&ns_g_entropy);if (ns_g_fallbackentropy != NULL)tybs_entropy_detach(&ns_g_fallbackentropy); tybs_taskmgr_destroy(&ns_g_taskmgr);tybs_timermgr_destroy(&ns_g_timermgr);tybs_socketmgr_destroy(&ns_g_socketmgr); tybs_hash_destroy();}static voidsetup(void) {tybs_result_t result;#ifdef HAVE_LIBSCFchar *instance = NULL;#endifns_os_inituserinfo(ns_g_username);ns_os_tzset();ns_os_opendevnull();#ifdef HAVE_LIBSCFresult = ns_smf_get_instance(&instance, 0,ns_g_mctx);if (result == TYBS_R_SUCCESS)ns_smf_got_instance = 1;elsens_smf_got_instance = 0;if (instance != NULL)tybs_mem_free(ns_g_mctx, instance);#endif /* HAVE_LIBSCF */#ifdef PATH_RANDOMDEVif (ns_g_chrootdir != NULL) {result = tybs_entropy_create(ns_g_mctx, &ns_g_fallbackentropy);if (result != TYBS_R_SUCCESS)ns_main_earlyfatal("tybs_entropy_create() failed: %s",tybs_result_totext(result));result = tybs_entropy_createfilesource(ns_g_fallbackentropy,PATH_RANDOMDEV);if (result != TYBS_R_SUCCESS) {ns_main_earlywarning("could not open pre-chroot ""entropy source %s: %s",PATH_RANDOMDEV,tybs_result_totext(result));tybs_entropy_detach(&ns_g_fallbackentropy);}}#endifns_os_chroot(ns_g_chrootdir);ns_os_minprivs();result = ns_log_init(TYBS_TF(ns_g_username != NULL)); if (result != TYBS_R_SUCCESS)ns_main_earlyfatal("ns_log_init() failed: %s",tybs_result_totext(result));if (!ns_g_foreground)ns_os_daemonize();result = tybs_app_start();if (result != TYBS_R_SUCCESS)ns_main_earlyfatal("tybs_app_start() failed: %s",tybs_result_totext(result));tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN,TYBS_LOG_NOTICE, "starting BIND %s%s", ns_g_version, saved_command_line);tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN,TYBS_LOG_NOTICE, "built with %s", ns_g_configargs);(void)tybs_resource_getlimit(tybs_resource_stacksize, &ns_g_initstacksize);(void)tybs_resource_getlimit(tybs_resource_datasize, &ns_g_initdatasize);(void)tybs_resource_getlimit(tybs_resource_coresize, &ns_g_initcoresize);(void)tybs_resource_getlimit(tybs_resource_openfiles, &ns_g_initopenfiles);if (! tybs_file_isabsolute(ns_g_conffile)) {result = tybs_file_absolutepath(ns_g_conffile,absolute_conffile,sizeof(absolute_conffile));if (result != TYBS_R_SUCCESS)ns_main_earlyfatal("could not construct absolute path of " "configuration file: %s",tybs_result_totext(result));ns_g_conffile = absolute_conffile;}result = tybs_time_now(&ns_g_boottime);if (result != TYBS_R_SUCCESS)ns_main_earlyfatal("tybs_time_now() failed: %s",tybs_result_totext(result));result = create_managers();if (result != TYBS_R_SUCCESS)ns_main_earlyfatal("create_managers() failed: %s",tybs_result_totext(result));ns_builtin_init();#ifdef DLZresult = dlz_drivers_init();if (result != TYBS_R_SUCCESS)ns_main_earlyfatal("dlz_drivers_init() failed: %s", tybs_result_totext(result));#endifns_server_create(ns_g_mctx, &ns_g_server);}static voidcleanup(void) {destroy_managers();ns_server_destroy(&ns_g_server);ns_builtin_deinit();#ifdef DLZdlz_drivers_clear();#endifdns_name_destroy();tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN,TYBS_LOG_NOTICE, "exiting");ns_log_shutdown();}static char *memstats = NULL;voidns_main_setmemstats(const char *filename) {if (memstats != NULL) {free(memstats);memstats = NULL;}if (filename == NULL)return;memstats = malloc(strlen(filename) + 1);if (memstats)strcpy(memstats, filename);}#ifdef HAVE_LIBSCFtybs_result_tns_smf_get_instance(char **ins_name, int debug, tybs_mem_t *mctx) {scf_handle_t *h = NULL;int namelen;char *instance;REQUIRE(ins_name != NULL && *ins_name == NULL);if ((h = scf_handle_create(SCF_VERSION)) == NULL) { if (debug)UNEXPECTED_ERROR(__FILE__, __LINE__,"scf_handle_create() failed: %s",scf_strerror(scf_error()));return (TYBS_R_FAILURE);}if (scf_handle_bind(h) == -1) {if (debug)UNEXPECTED_ERROR(__FILE__, __LINE__,"scf_handle_bind() failed: %s",scf_strerror(scf_error()));scf_handle_destroy(h);return (TYBS_R_FAILURE);}if ((namelen = scf_myname(h, NULL, 0)) == -1) {if (debug)UNEXPECTED_ERROR(__FILE__, __LINE__,"scf_myname() failed: %s",scf_strerror(scf_error()));scf_handle_destroy(h);return (TYBS_R_FAILURE);}if ((instance = tybs_mem_allocate(mctx, namelen + 1)) == NULL) { UNEXPECTED_ERROR(__FILE__, __LINE__,"ns_smf_get_instance memory ""allocation failed: %s",tybs_result_totext(TYBS_R_NOMEMORY));scf_handle_destroy(h);return (TYBS_R_FAILURE);}if (scf_myname(h, instance, namelen + 1) == -1) {if (debug)UNEXPECTED_ERROR(__FILE__, __LINE__, "scf_myname() failed: %s",scf_strerror(scf_error()));scf_handle_destroy(h);tybs_mem_free(mctx, instance);return (TYBS_R_FAILURE);}scf_handle_destroy(h);*ins_name = instance;return (TYBS_R_SUCCESS);}#endifintmain(int argc, char *argv[]) {tybs_result_t result;#ifdef HAVE_LIBSCFchar *instance = NULL;#endifstrlcat(version,#ifdef __DATE__"named version: BIND " VERSION " (" __DATE__ ")",#else"named version: BIND " VERSION,#endifsizeof(version));result = tybs_file_progname(*argv, program_name, sizeof(program_name));if (result != TYBS_R_SUCCESS)ns_main_earlyfatal("program name too long");if (strcmp(program_name, "lwresd") == 0)ns_g_lwresdonly = TYBS_TRUE;tybs_assertion_setcallback(assertion_failed);tybs_error_setfatal(library_fatal_error);tybs_error_setunexpected(library_unexpected_error);ns_os_init(program_name);dns_result_register();dst_result_register();tybscc_result_register();parse_command_line(argc, argv);if (ns_g_chrootdir != NULL) {int len = strlen(ns_g_chrootdir);if (strncmp(ns_g_chrootdir, ns_g_conffile, len) == 0 && (ns_g_conffile[len] == '/' || ns_g_conffile[len] == '\\')) ns_main_earlywarning("config filename (-c %s) contains " "chroot path (-t %s)",ns_g_conffile, ns_g_chrootdir);}result = tybs_mem_create(0, 0, &ns_g_mctx);if (result != TYBS_R_SUCCESS)ns_main_earlyfatal("tybs_mem_create() failed: %s",tybs_result_totext(result));tybs_mem_setname(ns_g_mctx, "main", NULL);setup();do {result = tybs_app_run();if (result == TYBS_R_RELOAD) {ns_server_reloadwanted(ns_g_server);} else if (result != TYBS_R_SUCCESS) {UNEXPECTED_ERROR(__FILE__, __LINE__,"tybs_app_run(): %s",tybs_result_totext(result));result = TYBS_R_SUCCESS;}} while (result != TYBS_R_SUCCESS);#ifdef HAVE_LIBSCFif (ns_smf_want_disable == 1) {result = ns_smf_get_instance(&instance, 1, ns_g_mctx); if (result == TYBS_R_SUCCESS && instance != NULL) {if (smf_disable_instance(instance, 0) != 0) UNEXPECTED_ERROR(__FILE__, __LINE__,"smf_disable_instance() ""failed for %s : %s",instance,scf_strerror(scf_error()));}if (instance != NULL)tybs_mem_free(ns_g_mctx, instance);}#endif /* HAVE_LIBSCF */cleanup();if (want_stats) {tybs_mem_stats(ns_g_mctx, stdout);tybs_mutex_stats(stdout);}if (ns_g_memstatistics && memstats != NULL) { FILE *fp = NULL;result = tybs_stdio_open(memstats, "w", &fp); if (result == TYBS_R_SUCCESS) {tybs_mem_stats(ns_g_mctx, fp);tybs_mutex_stats(fp);tybs_stdio_close(fp);}}tybs_mem_destroy(&ns_g_mctx);tybs_mem_checkdestroyed(stderr);ns_main_setmemstats(NULL);tybs_app_finish();ns_os_closedevnull();ns_os_shutdown();return (0);}#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS #include "php.h"#include <stdio.h>#include <fcntl.h>#ifdef PHP_WIN32#include "win32/time.h"#include "win32/signal.h"#include "win32/php_win32_globals.h"#include <process.h>#elif defined(NETWARE) #include <sys/timeval.h> #ifdef USE_WINSOCK#include <novsock2.h>#endif#endif#if HAVE_SYS_TIME_H#include <sys/time.h>#endif#if HAVE_UNISTD_H#include <unistd.h>#endif#if HAVE_SIGNAL_H#include <signal.h>#endif#if HAVE_SETLOCALE#include <locale.h>#endif#include "zend.h"#include "zend_extensions.h"#include "php_ini.h"#include "php_globals.h"#include "php_main.h"#include "fopen_wrappers.h"#include "ext/standard/php_standard.h" #include "php_variables.h"#include "ext/standard/credits.h"#ifdef PHP_WIN32#include <io.h>#include "win32/php_registry.h"#include "ext/standard/flock_compat.h" #endif#include "php_syslog.h"#include "Zend/zend_exceptions.h"#if PHP_SIGCHILD#include <sys/types.h>#include <sys/wait.h>#endif#include "zend_compile.h"#include "zend_execute.h"#include "zend_highlight.h"#include "zend_indent.h"#include "zend_extensions.h"#include "zend_ini.h"#include "php_content_types.h"#include "php_ticks.h"#include "php_logos.h"#include "php_streams.h"#include "php_open_temporary_file.h" #include "SAPI.h"#include "rfc1867.h"/* }}} */#ifndef ZTSphp_core_globals core_globals;#elsePHPAPI int core_globals_id;#endif#define SAFE_FILENAME(f) ((f)?(f):"-") /* {{{ PHP_INI_MH*/static PHP_INI_MH(OnSetPrecision){int i = atoi(new_value);if (i >= 0) {EG(precision) = i;return SUCCESS;} else {return FAILURE;}}static PHP_INI_MH(OnChangeMemoryLimit){if (new_value) {PG(memory_limit) = zend_atoi(new_value, new_value_length);} else {PG(memory_limit) = 1<<30; /* effectively, no limit */}return zend_set_memory_limit(PG(memory_limit));}static void php_disable_functions(TSRMLS_D){char *s = NULL, *e;if (!*(INI_STR("disable_functions"))) {return;}e = PG(disable_functions) = strdup(INI_STR("disable_functions")); while (*e) {switch (*e) {case ' ':case ',':if (s) {*e = '\0';zend_disable_function(s, e-s TSRMLS_CC); s = NULL;}break;default:if (!s) {s = e;}break;}e++;}if (s) {zend_disable_function(s, e-s TSRMLS_CC); }}static void php_disable_classes(TSRMLS_D){char *s = NULL, *e;if (!*(INI_STR("disable_classes"))) {return;}e = PG(disable_classes) = strdup(INI_STR("disable_classes")); while (*e) {switch (*e) {case ' ':case ',':if (s) {*e = '\0';zend_disable_class(s, e-s TSRMLS_CC);s = NULL;}break;default:if (!s) {s = e;}break;}e++;}if (s) {zend_disable_class(s, e-s TSRMLS_CC);}}static PHP_INI_MH(OnUpdateTimeout){EG(timeout_seconds) = atoi(new_value);if (stage==PHP_INI_STAGE_STARTUP) {/* Don't set a timeout on startup, only per-request */ return SUCCESS;}zend_unset_timeout(TSRMLS_C);zend_set_timeout(EG(timeout_seconds));return SUCCESS;}static int php_get_display_errors_mode(char *value, intvalue_length){int mode;if (!value) {return PHP_DISPLAY_ERRORS_STDOUT;}if (value_length == 2 && !strcasecmp("on", value)) {mode = PHP_DISPLAY_ERRORS_STDOUT;} else if (value_length == 3 && !strcasecmp("yes", value)) {mode = PHP_DISPLAY_ERRORS_STDOUT;} else if (value_length == 4 && !strcasecmp("true", value)) { mode = PHP_DISPLAY_ERRORS_STDOUT;} else if (value_length == 6 && !strcasecmp(value, "stderr")) {mode = PHP_DISPLAY_ERRORS_STDERR;} else if (value_length == 6 && !strcasecmp(value, "stdout")) { mode = PHP_DISPLAY_ERRORS_STDOUT;} else {mode = atoi(value);if (mode && mode != PHP_DISPLAY_ERRORS_STDOUT && mode !=PHP_DISPLAY_ERRORS_STDERR) {mode = PHP_DISPLAY_ERRORS_STDOUT;}}return mode;}static PHP_INI_MH(OnUpdateDisplayErrors){PG(display_errors) = (zend_bool)php_get_display_errors_mode(new_value, new_value_length);return SUCCESS;}static PHP_INI_DISP(display_errors_mode)。
软著申请源代码格式要求
软著申请源代码格式要求
软件著作权申请中的源代码格式要求通常包括以下几个方面:
1. 格式规范,源代码应当符合一定的格式规范,以确保代码的可读性和可维护性。
通常情况下,代码应当缩进合理、命名规范统一、注释清晰等。
2. 版本标识,在软件著作权申请中,需要提供源代码的版本标识,包括版本号、更新日期等信息,以便于对不同版本的代码进行比较和分析。
3. 完整性,申请软件著作权时,需要提交完整的源代码,确保所有相关的代码文件和依赖文件都包含在内,以便于对软件的功能和实现进行全面的评估。
4. 注释说明,源代码中应当包含详细的注释,对关键算法、功能模块、重要变量等进行说明,以便于他人阅读和理解代码的逻辑和设计思路。
5. 语言要求,根据软件开发的实际情况,源代码可以使用不同
的编程语言编写,但需要在申请中明确说明所使用的编程语言和相应的版本。
总的来说,软件著作权申请中的源代码格式要求主要是为了确保提交的代码能够清晰地展现软件的功能和实现逻辑,以便于著作权部门对软件进行评估和审查。
因此,在准备软件著作权申请时,需要仔细遵守相关的格式要求,并确保提交的源代码符合规定,以提高申请成功的几率。
计算机软件著作权登记-源代码例范本
package com.example.shuoya;import java.util.Set;import android.content.BroadcastReceiver;import android.content.Context;import android.content.Intent;import android.database.Cursor;import android.database.sqlite.SQLiteDatabase;import android.os.Bundle;import android.telephony.SmsMessage;import android.util.Log;import android.widget.Toast;public class Breast extends BroadcastReceiver{private static final String mACTION = "android.provider.Telephony.SMS_RECEIVED"; @Overridepublic void onReceive(Context context, Intent intent){// TODO Auto-generated method stubif (intent.getAction().equals(mACTION)){StringBuilder sb = new StringBuilder();Bundle bundle = intent.getExtras();if (bundle != null){Set<String> keysSet=bundle.keySet();for(String keyString:keysSet){Log.d("key", keyString);}Object[] myOBJpdus = (Object[]) bundle.get("pdus");SmsMessage[] messages = new SmsMessage[myOBJpdus.length];for (int i = 0; i<myOBJpdus.length; i++){messages[i] = SmsMessage.createFromPdu ((byte[]) myOBJpdus[i]);}for (SmsMessage currentMessage : messages){//sb.append("接收到来告:\n");//sb.append(currentMessage.getDisplayOriginatingAddress());//sb.append("\n------传来的短信------\n");sb.append(currentMessage.getDisplayMessageBody());}}Toast.makeText(context, sb, Toast.LENGTH_LONG).show();Intent i2 = new Intent(context, FuzhuActivity.class);Bundle bundle2=new Bundle();bundle2.putString("SMS", sb.toString());i2.putExtra("SMSS", bundle2);i2.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);context.startActivity(i2);}}}package com.example.shuoya;import android.content.Context;import android.database.sqlite.SQLiteDatabase;import android.database.sqlite.SQLiteDatabase.CursorFactory;import android.database.sqlite.SQLiteOpenHelper;public class DbAdapter extends SQLiteOpenHelper{private static final int VERSION = 1;private static final String DBNAME = "test.db";public DbAdapter(Context context, String name,CursorFactory factory, int version) {super(context, name, factory, version);// TODO Auto-generated constructor stub}public DbAdapter(Context context,String name){this(context,name,VERSION);}public DbAdapter(Context context){this(context,DBNAME,VERSION);}public DbAdapter(Context context,String name,int version){this(context,name,null,VERSION);}public void onCreate(SQLiteDatabase db) {// TODO Auto-generated method stub}public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { // TODO Auto-generated method stubSystem.out.println("update a database");}}package com.example.shuoya;import java.util.List;import com.example.shuoya.R;import android.app.AlertDialog;import android.content.Context;import android.database.DataSetObserver;import youtInflater;import android.view.MotionEvent;import android.view.View;import android.view.View.OnClickListener;import android.view.View.OnLongClickListener;import android.view.View.OnTouchListener;import android.view.ViewGroup;import android.widget.BaseAdapter;import android.widget.LinearLayout;import android.widget.TextView;//public class DetailAdapter implements ListAdapterpublic class DetailAdapter extends BaseAdapter{private List<DetailEntity> coll;private Context ctx;DetailEntity entity;LinearLayout layout;LayoutInflater vi;LinearLayout layout_bj;TextView tvName;TextView tvDate;TextView tvText;public DetailAdapter(Context context, List<DetailEntity> coll) {ctx = context;this.coll = coll;}public boolean areAllItemsEnabled(){return true;}public boolean isEnabled(int arg0){return true;}public int getCount(){return coll.size();}public Object getItem(int position){return coll.get(position);}public long getItemId(int position){return position;}public int getItemViewType(int position){return position;}public View getView(int position, View convertView, ViewGroup parent){entity = coll.get(position);int itemLayout = entity.getLayoutID();layout = new LinearLayout(ctx);vi = (LayoutInflater) ctx.getSystemService(YOUT_INFLATER_SERVICE);vi.inflate(itemLayout, layout, true);layout.setBackgroundColor(0xffB4B4B4);layout_bj = (LinearLayout) layout.findViewById(yout_bj);tvName = (TextView) layout.findViewById(R.id.messagedetail_row_name);tvName.setText(entity.getName());tvDate = (TextView) layout.findViewById(R.id.messagedetail_row_date);tvDate.setText(entity.getDate());tvText = (TextView) layout.findViewById(R.id.messagedetail_row_text);tvText.setText(entity.getText());addListener(tvName, tvDate, tvText, layout_bj);return layout;}public int getViewTypeCount(){return coll.size();}public boolean hasStableIds(){return true;}public boolean isEmpty(){return true;}@Overridepublic void registerDataSetObserver(DataSetObserver observer){// TODO Auto-generated method stub}@Overridepublic void unregisterDataSetObserver(DataSetObserver observer){// TODO Auto-generated method stub}public void addListener(final TextView tvName, final TextView tvDate,final TextView tvText, LinearLayout layout_bj){layout_bj.setOnClickListener(new OnClickListener(){@Overridepublic void onClick(View v){}});//实例并初始化TTS对象layout_bj.setOnLongClickListener(new OnLongClickListener(){@Overridepublic boolean onLongClick(final View v){tvName.setTextColor(0xffffffff);tvDate.setTextColor(0xffffffff);tvText.setTextColor(0xffffffff);new AlertDialog.Builder(ctx).setMessage("说呀聊天辅助系统-应答模式").setPositiveButton("确定",null).show();return true;}});////layout_bj.setOnTouchListener(new OnTouchListener(){@Overridepublic boolean onTouch(View v, MotionEvent event){switch (event.getAction()){case MotionEvent.ACTION_DOWN:case MotionEvent.ACTION_MOVE:tvName.setTextColor(0xffffffff);tvDate.setTextColor(0xffffffff);tvText.setTextColor(0xffffffff);break;default:tvName.setTextColor(0xff000000);tvDate.setTextColor(0xff000000);tvText.setTextColor(0xff0000ff);break;}return false;}});}}package com.example.shuoya;public class DetailEntity{private String name;private String date;private String text;private int layoutID;public String getName(){return name;}public void setName(String name){ = name;}public String getDate(){return date;}public void setDate(String date){this.date = date;}public String getText(){return text;}public void setText(String text){this.text = text;}public int getLayoutID(){return layoutID;}public void setLayoutID(int layoutID){youtID = layoutID;}public DetailEntity(){}public DetailEntity(String name, String date, String text, int layoutID) {super(); = name;this.date = date;this.text = text;youtID = layoutID;}}package com.example.shuoya;import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;import .URL;import .URLEncoder;public class Fenci{/* Called when the activity is first created. */static String u = "/fudannlp/";public String str;public static String nlp(String func, String input){String str1="";try{input = URLEncoder.encode(input, "utf-8");URL url = new URL( u + func + "/" + input);StringBuffer sb = new StringBuffer();BufferedReader out = new BufferedReader(new InputStreamReader(url.openStream(), "utf-8"));String line;while ((line = out.readLine()) != null)sb.append(line);str1=sb.toString();out.close();} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();}int i=str1.indexOf("s");str1=str1.substring(i+1);return str1;}}package com.example.shuoya;import java.io.File;import java.io.FileOutputStream;import java.io.InputStream;import java.io.OutputStream;import java.util.ArrayList;import java.util.List;import com.example.shuoya.R;import android.app.Activity;import android.app.AlertDialog;import android.content.Context;import android.content.DialogInterface;import android.content.Intent;import android.content.pm.PackageManager;import android.content.pm.ResolveInfo;import android.os.Bundle;import android.speech.RecognizerIntent;import youtInflater;import android.view.View;import android.view.Window;import android.view.View.OnClickListener;import android.view.WindowManager;import android.widget.AdapterView;import android.widget.AdapterView.OnItemClickListener;import android.widget.Button;import android.widget.EditText;import android.widget.ListView;import android.widget.PopupWindow;import android.widget.Toast;import android.database.Cursor;import android.database.sqlite.SQLiteDatabase;import android.graphics.drawable.BitmapDrawable;public class FuzhuActivity extends Activity{private ListView talkView;private List<DetailEntity> list = null;//menu菜单模块private PopupWindow popupWindow;private ListView lv_menu;private View view;private List<String> Menus;private static final int VOICE_RECOGNITION_REQUEST_CODE = 1234;private EditText mText1;private Button speakButton;private Button qdButton;private Button chooseButton;long exitTime=-2000;@Overridepublic void onCreate(Bundle savedInstanceState){super.onCreate(savedInstanceState);requestWindowFeature(Window.FEATURE_NO_TITLE);setContentView(yout.test);//将数据库放到手机中,测试时注释掉PackageManager pm = getPackageManager();//管理应用程序包List<ResolveInfo> activities = pm.queryIntentActivities(newIntent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH), 0);}public String getResponce(String et){String answer="";String myFenci=Fenci.nlp("pos",et);String mySubject,myPredicate,myObject;//定义主谓宾mySubject=GetWord.ReturnSubject(myFenci);myPredicate=GetWord.ReturnPredicate(myFenci);myObject=GetWord.ReturnObject(myFenci);DbAdapter dbHelper = new DbAdapter(FuzhuActivity.this,"test.db");//只有调用了DatabaseHelper对象的//getReadableDatabase()方法,或者是getWritableDatabase()方法之后,才会创建,或打开一个数据库SQLiteDatabase db = dbHelper.getReadableDatabase();int id_temp1,id_temp2,id_temp3;String search_id;Cursor cursor1;if(mySubject==null){id_temp1=0;}else{cursor1 = db.query("r_sheet", new String[]{"id"}, "charName=?", new String[]{mySubject}, null, null, null);if(cursor1.moveToNext()){//在r表中查询id_temp1=cursor1.getInt(cursor1.getColumnIndex("id"));}else{id_temp1=0;}}if(myPredicate==null){id_temp2=0;}else{cursor1 = db.query("verb_sheet", new String[]{"id"}, "verbName=?", new String[]{myPredicate}, null, null, null);if(cursor1.moveToNext()){//在v表中查询id_temp2=cursor1.getInt(cursor1.getColumnIndex("id"));}else{id_temp2=0;}}if(myObject==null){id_temp3=0;}else{cursor1 = db.query("noun_sheet", new String[]{"id"}, "nounName=?", new String[]{myObject}, null, null, null);if(cursor1.moveToNext()){//在n表中查询id_temp3=cursor1.getInt(cursor1.getColumnIndex("id"));}else{id_temp3=0;}}search_id=numberToString(id_temp1)+numberToString(id_temp2)+numberToString(id_temp3);cursor1 = db.query("answer_sheet", new String[]{"answer"}, "id=?", new String[]{search_id}, null, null, null);if(cursor1.moveToNext()){//在answer表中查询answer=cursor1.getString(cursor1.getColumnIndex("answer"));}else{}if(answer!=""){Toast.makeText(getApplicationContext(), answer, Toast.LENGTH_LONG).show();}else if(answer==""){Toast.makeText(getApplicationContext(), "暂无提示", Toast.LENGTH_LONG).show();}else{Toast.makeText(getApplicationContext(), "暂无提示", Toast.LENGTH_LONG).show();}return answer;}public String numberToString(int number){String s="";if (number==0||number<10)s="00"+String.valueOf(number);else if(number<100)s="0"+String.valueOf(number);elses=String.valueOf(number);return s;}}package com.example.shuoya;import android.os.AsyncTask;public class GetResTask extends AsyncTask<String,V oid,String>{TestActivity atxs=new TestActivity();@Overrideprotected String doInBackground(String... params) {// TODO Auto-generated method stubreturn atxs.getResponce(params[0]);}protected V oid onPostExcute(String result){return null;}}package com.example.shuoya;import unchOnKeyguardExit;import android.app.Activity;import android.content.Intent;import android.content.SharedPreferences;import android.graphics.Bitmap;import android.os.Bundle;import android.preference.PreferenceManager;import android.view.Display;import android.view.View;import android.view.Window;import android.view.WindowManager;import android.view.View.OnClickListener;import android.widget.Button;import android.widget.ImageView;import android.widget.LinearLayout;import android.widget.ScrollView;import android.widget.TextView;public class SMSPopupActivity extends Activity {private SmsMmsMessage message;private boolean exitingKeyguardSecurely = false;private Bundle bundle = null;private SharedPreferences myPrefs;private TextView headerTV;private TextView messageTV;private TextView fromTV;private TextView mmsSubjectTV;private LinearLayout viewButtonLayout;private LinearLayout mmsLinearLayout;private ScrollView messageScrollView;private boolean wasVisible = false;private final double WIDTH = 0.8;@Overrideprotected void onCreate(Bundle bundle) {super.onCreate(bundle);Log.v("SMSPopupActivity: onCreate()");//First things first, acquire wakelock, otherwise the phone may sleepManageWakeLock.acquirePartial(getApplicationContext());requestWindowFeature(Window.FEATURE_NO_TITLE);setContentView(yout.popup);//Get shared prefsmyPrefs = PreferenceManager.getDefaultSharedPreferences(this);//Check preferences and then blur out background behind windowif (myPrefs.getBoolean(getString(R.string.pref_blur_key),Boolean.valueOf(getString(R.string.pref_blur_default)))) {getWindow().setFlags(youtParams.FLAG_BLUR_BEHIND, youtParams.FLAG_BLUR_BEHIND);}//This sets the minimum width of the activity to 75% of the screen size//only needed because the theme of this activity is "dialog" so it looks//like it's floating and doesn't seem to fill_parent like a regular activity LinearLayout mainLL = (LinearLayout) findViewById(R.id.MainLinearLayout); Display d = getWindowManager().getDefaultDisplay();int width = (int)(d.getWidth() * WIDTH);Log.v("setting width to: " + width);mainLL.setMinimumWidth(width);//Find the main textviewsfromTV = (TextView) findViewById(R.id.FromTextView);messageTV = (TextView) findViewById(R.id.MessageTextView);headerTV = (TextView) findViewById(R.id.HeaderTextView);mmsSubjectTV = (TextView) findViewById(R.id.MmsSubjectTextView); viewButtonLayout = (LinearLayout) findViewById(R.id.ViewButtonLinearLayout); messageScrollView = (ScrollView) findViewById(R.id.MessageScrollView); mmsLinearLayout = (LinearLayout) findViewById(R.id.MmsLinearLayout);//The close buttonButton closeButton = (Button) findViewById(R.id.closeButton);closeButton.setOnClickListener(new OnClickListener() {public void onClick(View v) {Intent i = new Intent(SMSPopupActivity.this.getApplicationContext(), SMSPopupUtilsService.class);// i.putExtra(SMSPopupUtilsService.EXTRAS_THREAD_ID,// message.getThreadId());i.setAction(SMSPopupUtilsService.ACTION_MARK_THREAD_READ);i.putExtras(message.toBundle());SMSPopupUtilsService.beginStartingService(SMSPopupActivity.this.getApplicationContext(), i);// Finish up this activitymyFinish();}});//The inbox buttonButton inboxButton = (Button) findViewById(R.id.InboxButton);inboxButton.setOnClickListener(new OnClickListener() {public void onClick(View v) {exitingKeyguardSecurely = true;ManageKeyguard.exitKeyguardSecurely(new LaunchOnKeyguardExit() {public void LaunchOnKeyguardExitSuccess() {Intent i = SMSPopupUtils.getSmsIntent();SMSPopupActivity.this.getApplicationContext().startActivity(i);}});myFinish();}});//The view button (if in privacy mode)Button viewButton = (Button) findViewById(R.id.ViewButton);viewButton.setOnClickListener(new OnClickListener() {public void onClick(View v) {exitingKeyguardSecurely = true;ManageKeyguard.exitKeyguardSecurely(new LaunchOnKeyguardExit() {public void LaunchOnKeyguardExitSuccess() {Intent i = getIntent();i.putExtra(SmsMmsMessage.EXTRAS_NOTIFY, false);startActivity(i);// finish();}});}});//The reply buttonButton replyButton = (Button) findViewById(R.id.replyButton);replyButton.setOnClickListener(new OnClickListener() {public void onClick(View v) {exitingKeyguardSecurely = true;ManageKeyguard.exitKeyguardSecurely(new LaunchOnKeyguardExit() {public void LaunchOnKeyguardExitSuccess() {Intent reply = message.getReplyIntent();SMSPopupActivity.this.getApplicationContext().startActivity(reply);}});ManageNotification.clearAll(SMSPopupActivity.this.getApplicationContext(), true);myFinish();}});// The ViewMMS buttonButton viewMmsButton = (Button) findViewById(R.id.ViewMmsButton); viewMmsButton.setOnClickListener(new OnClickListener() {public void onClick(View v) {exitingKeyguardSecurely = true;ManageKeyguard.exitKeyguardSecurely(new LaunchOnKeyguardExit() {public void LaunchOnKeyguardExitSuccess() {Intent reply = message.getReplyIntent();SMSPopupActivity.this.getApplicationContext().startActivity(reply);}});ManageNotification.clearAll(SMSPopupActivity.this.getApplicationContext(), true);myFinish();}});if (bundle == null) {populateViews(getIntent().getExtras());} else {populateViews(bundle);}wakeApp();}@Overrideprotected void onNewIntent(Intent intent) {super.onNewIntent(intent);Log.v("SMSPopupActivity: onNewIntent()");//First things first, acquire wakelock, otherwise the phone may sleepManageWakeLock.acquirePartial(getApplicationContext());setIntent(intent);//Re-populate views with new intent data (ie. new sms data)populateViews(intent.getExtras());wakeApp();}@Overrideprotected void onStart() {super.onStart();Log.v("SMSPopupActivity: onStart()");ManageWakeLock.acquirePartial(getApplicationContext());}@Overrideprotected void onResume() {super.onResume();Log.v("SMSPopupActivity: onResume()");wasVisible = false;//Reset exitingKeyguardSecurely bool to falseexitingKeyguardSecurely = false;}@Overrideprotected void onPause() {super.onPause();Log.v("SMSPopupActivity: onPause()");if (wasVisible) {//Cancel the receiver that will clear our locksClearAllReceiver.removeCancel(getApplicationContext());ClearAllReceiver.clearAll(!exitingKeyguardSecurely);}}@Overrideprotected void onStop() {super.onStop();Log.v("SMSPopupActivity: onStop()");//Cancel the receiver that will clear our locksClearAllReceiver.removeCancel(getApplicationContext());ClearAllReceiver.clearAll(!exitingKeyguardSecurely);}@Overridepublic void onWindowFocusChanged(boolean hasFocus) {super.onWindowFocusChanged(hasFocus);Log.v("SMSPopupActivity: onWindowFocusChanged(" + hasFocus + ")");if (hasFocus) {wasVisible = true;}}@Overridepublic void onSaveInstanceState(Bundle outState) {super.onSaveInstanceState(outState);Log.v("SMSPopupActivity: onSaveInstanceState()");outState.putAll(bundle);}private void myFinish() {ManageNotification.clearAll(getApplicationContext());ReminderReceiver.cancelReminder(getApplicationContext());finish();}private void populateViews(Bundle b) {bundle = b;message = new SmsMmsMessage(getApplicationContext(), bundle);refreshPrivacy();ImageView iv = (ImageView) findViewById(R.id.FromImageView);Bitmap contactPhoto = message.getContactPhoto();if (contactPhoto != null) {iv.setImageBitmap(contactPhoto);} else {iv.setImageDrawable(getResources().getDrawable(android.R.drawable.ic_dialog_info));}LinearLayout mLL = (LinearLayout) findViewById(R.id.UnreadCountLinearLayout);TextView tv = (TextView) findViewById(R.id.UnreadCountTextView);if (message.getUnreadCount() <= 1) {mLL.setVisibility(View.GONE);tv.setText("");} else {String textWaiting = String.format(getString(R.string.unread_text_waiting), message.getUnreadCount() - 1);tv.setText(textWaiting);mLL.setVisibility(View.VISIBLE);}String headerText = getString(R.string.new_text_at);headerText = headerText.replaceAll("%s", message.getFormattedTimestamp());fromTV.setText(message.getContactName());if (message.getMessageType() == SmsMmsMessage.MESSAGE_TYPE_SMS) {messageTV.setText(message.getMessageBody());} else {mmsSubjectTV.setText(getString(R.string.mms_subject) + " " + message.getMessageBody());}headerTV.setText(headerText);}private void refreshPrivacy() {ManageKeyguard.initialize(getApplicationContext());boolean privacyMode = myPrefs.getBoolean(getString(R.string.pref_privacy_key),Boolean.valueOf(getString(R.string.pref_privacy_default)));if (message.getMessageType() == SmsMmsMessage.MESSAGE_TYPE_MMS) {viewButtonLayout.setVisibility(View.GONE);messageScrollView.setVisibility(View.GONE);mmsLinearLayout.setVisibility(View.VISIBLE);boolean subjectAvailable = true;if (message.getMessageBody() == null) {subjectAvailable = false;} else {if (message.getMessageBody().length() == 0) {subjectAvailable = false;}}if (!subjectAvailable) {mmsSubjectTV.setVisibility(View.GONE);} else {mmsSubjectTV.setVisibility(View.VISIBLE);}} else {mmsLinearLayout.setVisibility(View.GONE);if (privacyMode && ManageKeyguard.inKeyguardRestrictedInputMode()) { viewButtonLayout.setVisibility(View.VISIBLE);messageScrollView.setVisibility(View.GONE);} else {viewButtonLayout.setVisibility(View.GONE);messageScrollView.setVisibility(View.VISIBLE);}}}private void wakeApp() {ManageWakeLock.acquireFull(getApplicationContext());if (message.getNotify()) {bundle.putBoolean(SmsMmsMessage.EXTRAS_NOTIFY, false);message.updateReminderCount(0);ReminderReceiver.scheduleReminder(getApplicationContext(), message);ManageNotification.show(getApplicationContext(), message);}}@Overrideprotected void onDestroy() {Log.v("onDestroy()");super.onDestroy();}}package com.example.shuoya;import android.content.BroadcastReceiver;import android.content.Context;import android.content.Intent;public class SMSReceiver extends BroadcastReceiver {@Overridepublic void onReceive(Context context, Intent intent) {Log.v("SMSReceiver: onReceive()");intent.setClass(context, SMSReceiverService.class);intent.putExtra("result", getResultCode());SMSReceiverService.beginStartingService(context, intent);}}package com.example.shuoya;import android.app.AlarmManager;import android.app.PendingIntent;import android.content.BroadcastReceiver;import android.content.Context;import android.content.Intent;import android.content.SharedPreferences;import android.preference.PreferenceManager;public class ReminderReceiver extends BroadcastReceiver {private static PendingIntent reminderPendingIntent = null;@Overridepublic void onReceive(Context context, Intent intent) {intent.setClass(context, ReminderReceiverService.class);ReminderReceiverService.beginStartingService(context, intent);}public static void scheduleReminder(Context context, SmsMmsMessage message) {SharedPreferences myPrefs = PreferenceManager.getDefaultSharedPreferences(context);boolean reminder_notifications = myPrefs.getBoolean(context.getString(R.string.pref_notif_repeat_key), Boolean.valueOf(context.getString(R.string.pref_notif_repeat_default)));if (reminder_notifications) {int reminder_interval = Integer.parseInt(myPrefs.getString(context.getString(R.string.pref_notif_repeat_interval_key), context.getString(R.string.pref_notif_repeat_interval_default)));reminder_interval *= 60;AlarmManager myAM = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);Intent reminderIntent = new Intent(context, ReminderReceiver.class);reminderIntent.setAction(ReminderReceiverService.ACTION_REMIND);message.incrementReminderCount();reminderIntent.putExtras(message.toBundle());reminderPendingIntent = PendingIntent.getBroadcast(context, 0, reminderIntent, PendingIntent.FLAG_CANCEL_CURRENT);long triggerTime = System.currentTimeMillis() + (reminder_interval * 1000);Log.v("ReminderReceiver: scheduled reminder notification in " + reminder_interval + " seconds, count is " + message.getReminderCount());myAM.set(AlarmManager.RTC_WAKEUP, triggerTime, reminderPendingIntent);}}public static void cancelReminder(Context context) {if (reminderPendingIntent != null) {AlarmManager myAM = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);myAM.cancel(reminderPendingIntent);reminderPendingIntent.cancel();reminderPendingIntent = null;Log.v("ReminderReceiver: cancelReminder()");}}}package com.example.shuoya;import android.app.Activity;import android.app.Service;import android.content.Context;import android.content.Intent;import android.content.SharedPreferences;import android.os.Bundle;import android.os.Handler;import android.os.HandlerThread;import android.os.IBinder;import android.os.Looper;import android.os.Message;import android.os.PowerManager;import android.os.Process;import android.preference.PreferenceManager;import android.telephony.gsm.SmsManager;import android.telephony.gsm.SmsMessage;public class SMSReceiverService extends Service {private static final String ACTION_SMS_RECEIVED = "android.provider.Telephony.SMS_RECEIVED";private static final String ACTION_MMS_RECEIVED ="android.provider.Telephony.WAP_PUSH_RECEIVED";private static final String MMS_DA TA_TYPE = "application/vnd.wap.mms-message";private static final String ACTION_MESSAGE_SENT = "com.android.mms.transaction.MESSAGE_SENT";private Context context;private ServiceHandler mServiceHandler;private Looper mServiceLooper;private int mResultCode;static final Object mStartingServiceSync = new Object();static PowerManager.WakeLock mStartingService;@Overridepublic void onCreate() {Log.v("SMSReceiverService: onCreate()");HandlerThread thread = new HandlerThread(Log.LOGTAG,Process.THREAD_PRIORITY_BACKGROUND);thread.start();context = getApplicationContext();mServiceLooper = thread.getLooper();mServiceHandler = new ServiceHandler(mServiceLooper);}@Overridepublic void onStart(Intent intent, int startId) {Log.v("SMSReceiverService: onStart()");。
软件登记源程序源代码参考样本
if (gridView[j, i].ValueType == typeof(string)) {
excel.Cells[i + 2, j + 1] = "'" + gridView[j, i].Value.ToString(); } else {
ParameterDirection.ReturnValue, false, 0, 0,
string.Empty, DataRowVersion.Default, null));
return cmd;
}
#endregion
}
}
usingБайду номын сангаасSystem;
using System.Collections.Generic;
cmd.ExecuteNonQuery();
this.Close();
return 1;
}
public DataSet RunProcReturn(string procName, SqlParameter[] prams, string tbName)
{
SqlDataAdapter dap = CreateDataAdaper(procName, prams);
{
return data.RunProc("insert into tb_units (units,linkman,address,tel,memo) values
}
public int UpdateUnits(string units, string linkman, string address, string tel, string
软件著作权-源代码范本
软件著作权-源代码范本注意事项:常见的源代码包含:C语言,VB,C++,JAVA,。
NET等。
提交的代码必须是源代码的开头载入程序,第30页必须断开,第60页是软件的程序结尾,代码中不得出现与申请表内容不符合的日期,著作权人,软件名字等,不能出现开源代码,不能出现任何版权纠纷.格式要求:一、源代码应提交前、后各连续30页,不足60页的,应当全部提交。
二、源代码页眉应标注软件的名称和版本号,应当与申请表中名称完全一致,页眉右上应标注页码,源代码每页不少于50行。
范例如下:#include <tybs/commandline.h〉#include <tybs/dir。
h>#include <tybs/entropy.h〉#include <tybs/file.h>#include 〈tybs/hash。
h>#include 〈tybs/os.h〉#include 〈tybs/platform。
h>#include <tybs/resource。
h>#include 〈tybs/stdio。
h>#include 〈tybs/string。
h>#include <tybs/task。
h>#include 〈tybs/timer。
h>#include 〈tybs/util。
h>#include <tybscc/result。
h>#include <dns/dispatch.h〉#include <dns/name.h〉#include <dns/result.h>#include <dns/view.h>#include 〈dst/result.h〉#define NS_MAIN 1#include 〈named/ns_smf_globals。
h〉#endif#ifdef DLZ#include <dlz/dlz_drivers。
软件著作权申请的流程及注意事项
一、软件著作权申请的流程及注意事项(一)申请流程1、填写软件基本信息采集表;2、提供部分源程序(电子版):您提供该软件的word电子版部分源程序(前2000行和后2000行,共计4000行,最后一页为软件退出部分代码);3、提供手册(电子版):根据软件的不同类型,需要您提供word版软件使用操作手册或者软件设计说明书;4、报送审查;5、版权中心复审:初审通过受理后审查31-35个工作日,约45-50天左右出审查结果并公告;7、公告发证;(二)注意事项根据中国版权保护中心官方通知,申请计算机软件著作权需要注意:1、申请人可以自己办理计算机软件著作权登记,也可以委托代理机构办理登记。
2、申请人应当将所提交的申请文件留存一份,便于在补正程序中保持文件内容的一致。
3、办理软件著作权转让或专有合同登记可到登记大厅现场办理,也可使用挂号信函或特快专递邮寄到中国版权保护中心软件登记部。
4、申请表应当在线打印,请勿擅自更改表格格式;申请文件都应当按规定签章,签章应当与申请表中填写的姓名或者名称完全一致。
5、申请人或代理人信息栏内的详细地址,请务必填写准确的实际联系地址,以中国版权保护中心邮寄证书或其它书面邮件。
6、著作权人为企业法人或事业法人的应提交有效的企业法人营业执照或事业单位法人证书副本复印件,并需加盖单位公章;7、著作权人为自然人的,应提交有效的自然人身份证复印件(正反面复印)。
并需提交非职务开发保证书或非职务开发证明。
(下载《非职务开发证明》《非职务开发保证书》)。
8、著作权人为外国自然人的,应提交护照复印件,及护照复印件的中文译本,并需翻译者签章。
二、软件著作权申请材料有哪些1、软件著作权登记申请表应提交在线填写的申请表打印件,请勿复制、下载和擅自更改表格格式,签章应为原件。
2、软件(程序、文档)的鉴别材料一般交存:源程序和文档应提交前、后各连续30页,不足60页的,应当全部提交;例外交存:请按照《计算机软件著作权登记办法》第十二条规定的方式之一提交软件的鉴别材料。
计算机软件著作权登记-源代码范本如何提交?
The realization of the goal is based on my strong desire to succeed.精品模板助您成功!(页眉可删)计算机软件著作权登记-源代码范本如何提交?计算机软件著作权登记-源代码范本的提交需要有关的当事人把源程序的前、后各连续的30页,其中的机密部分用黑色宽斜线覆盖,但覆盖部分不得超过交存源程序的50%;目标程序的前、后各连续的30页,加上源程序的任何部分的连续的20页进行整合。
计算机软件著作权登记-源代码范本如何提交计算机软件著作权登记按照中华人民共和国国家版权局年颁布的《计算机软件著作权登记办法》第十二条申请软件著作权登记的,可以选择以下方式之一对鉴别材料作例外交存:(一)源程序的前、后各连续的30页,其中的机密部分用黑色宽斜线覆盖,但覆盖部分不得超过交存源程序的50%;(二)源程序连续的前10页,加上源程序的任何部分的连续的50页;(三)目标程序的前、后各连续的30页,加上源程序的任何部分的连续的20页。
计算机软件著作权登记,指软件著作权人协商不一致的,任何著作权人均可在不损害其他著作权人利益的前提下申请登记,但应当注明其他著作权人。
第一条为贯彻《计算机软件保护条例》(以下简称《条例》)制定本办法。
第二条为促进我国软件产业发展,增强我国信息产业的创新能力和竞争能力,国家著作权行政管理部门鼓励软件登记,并对登记的软件予以重点保护。
第三条本办法适用于软件著作权登记、软件著作权专有许可合同和转让合同登记。
第四条软件著作权登记申请人应当是该软件的著作权人以及通过继承、受让或者承受软件著作权的自然人、法人或者其他组织。
软件著作权合同登记的申请人,应当是软件著作权专有许可合同或者转让合同的当事人。
第五条申请人或者申请人之一为外国人、无国籍人的,适用本办法。
第六条国家版权局主管全国软件著作权登记管理工作。
国家版权局认定中国版权保护中心为软件登记机构。
python申请软著源代码
python申请软著源代码申请软著的源代码通常指的是软件著作权的申请材料中所需的软件源代码。
在申请软件著作权时,需要提供软件的源代码作为证明。
对于 Python 语言的软件,您可以按照以下步骤准备申请软著的源代码:1. 打开您的 Python 项目,找到主要的源代码文件和相关依赖文件。
这些文件通常以 .py 为后缀。
2. 将项目中所有的源代码文件(包括主文件和依赖文件)复制到一个新的文件夹中,以便整理和提交。
3. 确保源代码文件中不包含任何敏感信息或私密数据,例如数据库密码、API 密钥等。
如果有敏感信息,请在复制源代码之前进行删除或替换。
4. 检查源代码文件的编码格式是否为 UTF-8,这是软著申请要求的常见编码格式。
5. 如果您的项目使用了第三方库或框架,确保在源代码文件中包含了这些库的引用和依赖关系。
您可以在源代码文件的开头或注释中注明使用的第三方库和版本信息。
6. 如果您的项目有多个模块或组件,建议将每个模块的源代码放在不同的文件中,并在文件中添加合适的注释和说明,以便评审人员更好地理解您的代码结构和功能。
7. 检查源代码文件的格式和排版是否清晰易读,可以使用代码编辑器或自动化工具进行格式化和排版,以提高可读性。
8. 在准备软著申请材料时,将整理好的源代码文件打包成一个压缩文件,例如 ZIP 或 RAR 格式。
确保压缩文件不包含其他无关文件。
9. 在软著申请表格中按要求填写相关信息,包括软件名称、版本号、作者信息等。
同时,将准备好的源代码压缩文件附加在申请材料中一并提交。
请注意,以上步骤仅为一般性指导,具体的软著申请要求可能因地区和法规而有所不同。
建议您在申请软著之前,仔细阅读当地软著申请指南或咨询专业律师以确保申请的准确性和合法性。
软件著作权申请材料清单(源代码的整理)
附件二:(如何整理源代码—源代码注意的事项)
1、看你的软件是否是分:主要模块和次要模块---如果有主次模块之分---请提供主要模块的前后各2000行。
2、如果没有主次要模块之分:就从源代码的最开头提供前2000行,最后结尾提供后2000行。
代码的要求
1.
代码要求是提供原始的代码不是关键代码语法上要求完整
例如C++代码应该是 include 之类开头的而不是直接一开始就是函数
C#代码应该是 using 之类开头的而不是直接一开始就是函数
例如以下为完整的C#代码开头
要求提供的是对应的代码文件的原始文本
2.
第一页应该是以下一种情况所在的页面的原始代码
1.主函数
2.程序的入口比如登录函数
3.主页比如index default页面
3.
尽量少提供或者不提供设计器生成的代码
以C#语言为例设计器生成的代码语言文件一般为XXXt.designer.cs:
内容比如
4.
代码量4000行以下的提供全部源代码
代码量4000行以上的至少提供4000行代码Word中有行数统计功能
方法如下。
计算机软著申请源程序量
计算机软著申请源程序量一、源程序量的定义和重要性源程序是指计算机软件的源代码,是计算机程序员编写的能够被计算机解读和执行的指令集合。
源程序量是指软件中源代码的总行数或总字节数,用于衡量软件的规模和复杂程度。
源程序量的多少直接反映了软件的开发难度、创新程度和独特性。
源程序量是计算机软著申请中的重要指标之一,它可以用来证明软件的创新性和原创性。
通常情况下,源程序量越大,代表软件的开发工作量越大,创新程度和独特性也相应增加。
因此,源程序量是计算机软著申请中的一个重要参考指标。
二、计算机软著申请中源程序量的确定方法计算机软著申请需要提供软件的源代码,源程序量的确定方法主要有两种:行数统计法和字节数统计法。
行数统计法是通过统计源代码中的行数来确定源程序量,而字节数统计法则是通过统计源代码中的字节数来确定源程序量。
行数统计法是比较常见的一种方法,它可以通过统计源代码中的代码行、注释行和空行的数量来计算源程序量。
在计算源程序量时,通常只计算源代码中的代码行和注释行,而空行不计算在内。
这种方法相对简单,但可能存在一定的主观性,因为不同人对于代码行和注释行的定义可能会有所不同。
字节数统计法是另一种常见的方法,它可以通过统计源代码中的字节数来计算源程序量。
在计算字节数时,通常将源代码文件转换为二进制文件,然后统计二进制文件中的字节数。
这种方法相对精确,但需要使用特定的工具来进行转换和统计。
三、源程序量的评估标准和注意事项在计算机软著申请中,源程序量的评估标准和注意事项需要特别关注。
首先,源程序量应该与软件的规模和复杂程度相匹配,过小或过大的源程序量都可能对软件的创新性和原创性产生负面影响。
其次,源程序量应该反映软件的独特性和创新性,不能简单地通过复制粘贴或增加无效代码来增加源程序量。
最后,源程序量的计算应该遵循相应的规范和标准,确保计算的准确性和可靠性。
四、源程序量的申请实例和案例分析为了更好地理解源程序量在计算机软著申请中的应用,下面将通过一个实际案例进行分析。
申请软件的流程和材料
1.加盖公章的《计算机软件著作权申请表》一份。
由咨询机构提供,填写内容由咨询机构协
助申请企业填写。
2
2.加盖企业公章的营业执照副本复印件一份。
3
3.软件源程序一份。
一般按照源程序的前30页和后30页提供,而且源程序的作者应该是著
作权人,源程序中的日期须在开发完成日期之前,源程序当中的名称必须与申请表中全称或简称保持一致。
要求:
(4000行不包含注释和空格行),前2000行和后2000行
4.文档一份。
如操作手册、用户手册、使用说明书、设计说明书等等,任选其中一种。
文档中的
日期应在软件开发完成的日期之前,文档中若有图片出现,须提供使用该图片的证明材料即可。
要求:
(1)按前、后各连续30页,共60页(不足60页全部提交),文档要求每页不少于35行(结束页除外)A4纸单面黑白打印;
(2)文档应在页眉上标注相应的软件名称和版本号,右上角应标注页码,页脚要注明著作权人全称;
(3)必须图文并茂,图片必须清晰可见(图片上如果含有文字必须清晰可见);
备注:软件不是管理类的,比如是控制类软件,游戏软件,仪器设备软件,嵌入式软件等必须要提供软件设计文档,如果软件有操作界面的,是软件设计文档+操作手册,没有界面的只需要提供详细软件设计文档,计文档一般15页左右
5.填写《代理委托书》一份
6.如软件是在linux平台上以GCC开发的,需提交:《GPL声明》一份
7.个人申请者需下载并填写《非职务软件开发保证书》一份
8.其他软件权属证明文件(一般不需要,只有在委托开发等特殊情况下需要提供)。
软件著作权源程序模板
源程序清单办公自动化系统V1.0 中国版权保护中心using System;using System.Collections;using ponentModel;using System.Data;using System.Drawing;using System.Web;using System.Web.SessionState;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.HtmlControls;using System.Configuration;using System.Data.SqlClient;namespace OfficeOnline{///<summary>/// AddAdvice 的摘要说明。
///</summary>public class AddAdvice : System.Web.UI.Page{protected System.Web.UI.WebControls.TextBox tbxempname;protected System.Web.UI.WebControls.TextBox tbxtitle;protected System.Web.UI.WebControls.TextBox tbxcontent;protected System.Web.UI.WebControls.Button btnSubmit;private void Page_Load(object sender, System.EventArgs e){// 在此处放置用户代码以初始化页面}#region Web 窗体设计器生成的代码override protected void OnInit(EventArgs e){//// CODEGEN: 该调用是 Web 窗体设计器所必需的。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
**汽车商城管理系统源程序using System;using System.Collections.Generic;using System.Text;namespace Qing.Model{/// <summary>/// 购物车实体类/// </summary>[Serializable]public partial class cart_keys{public cart_keys() { }#region Modelprivate int _article_id;private int _quantity = 0;/// <summary>/// 文章ID/// </summary>public int article_id{set { _article_id = value; }get { return _article_id; }}/// <summary>/// 购买数量/// </summary>public int quantity{set { _quantity = value; }get { return _quantity; }}#endregion}/// <summary>/// 购物车列表/// </summary>[Serializable]public partial class cart_items{public cart_items(){ }#region Modelprivate int _article_id;private string _goods_no = string.Empty;private string _title = string.Empty;private string _spec_text = string.Empty; private string _img_url = string.Empty;private decimal _sell_price = 0M;private decimal _user_price = 0M;private int _quantity = 1;private int _stock_quantity = 0;/// <summary>/// 文章ID/// </summary>public int id{set { _article_id = value; }get { return _article_id; }}/// <summary>/// 商品货号/// </summary>public string goods_no{set { _goods_no = value; }get { return _goods_no; }}/// <summary>/// 商品名称/// </summary>public string title{set { _title = value; }get { return _title; }}/// <summary>/// 商品地址/// </summary>public string linkurl { get; set; } /// <summary>/// 商品规格/// </summary>public string spec_text{set { _spec_text = value; }get { return _spec_text; }}/// <summary>/// 图片路径/// </summary>public string img_url{set { _img_url = value; }get { return _img_url; }}/// <summary>/// 销售单价/// </summary>public decimal sell_price{set { _sell_price = value; }get { return _sell_price; }}/// <summary>/// 会员单价/// </summary>public decimal user_price{set { _user_price = value; }get { return _user_price; }}/// <summary>/// 购买数量/// </summary>public int quantity{get { return _quantity; }set { _quantity = value; }}/// <summary>/// 库存数量/// </summary>public int stock_quantity{set { _stock_quantity = value; } get { return _stock_quantity; } }#endregion}/// <summary>/// 购物车统计/// </summary>[Serializable]public partial class cart_total{public cart_total(){ }#region Modelprivate int _total_num = 0;private int _total_quantity = 0;private decimal _payable_amount = 0M; private decimal _real_amount = 0M;private int _total_point = 0;/// <summary>/// 商品种数/// </summary>public int total_num{set { _total_num = value; }get { return _total_num; }}/// <summary>/// 商品总数量/// </summary>public int total_quantity{set { _total_quantity = value; } get { return _total_quantity; } }/// <summary>/// 应付商品总金额/// </summary>public decimal payable_amount{set { _payable_amount = value; } get { return _payable_amount; } }/// <summary>/// 实付商品总金额/// </summary>public decimal real_amount{set { _real_amount = value; }get { return _real_amount; }}#endregion}}using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace Qing.Model{[Serializable][Table(Name = "contents")]public class Earticles{public Earticles(){addtime = DateTime.Now;islock = 0;taxis = DateTime.Now.Ticks / 100000;}[Id(Name = "id", Strategy = GenerationType.INDENTITY)]public int id{ get; set; }public int nodeid{ get; set; }[Column(IsInsert = false, IsUpdate = false)]public string nodename { get; set; }[Column(IsInsert = false, IsUpdate = false)]public int dep_id { get; set; }[Column(IsUpdate = false)]public string adduser{ get; set; }public DateTime addtime{ get; set; }public string lastuser{ get; set; }[Column(IsInsert = false)]public DateTime lasttime { get; set; }public long taxis{ get; set; }public string title{ get; set; }public string subtitle{ get; set; }public string imgurl{ get; set; }public string linkurl{ get; set; }public int istj{ get; set; }public int istop{ get; set; }public int ispics{ get; set; }public int ishot{ get; set; }public int islock{ get; set; }[Column(Ignore = true)]public earticlelock eislock{get { return (earticlelock)islock; }set { islock = (int)value; }}public string content{ get; set; }public string author{ get; set; }public string source{ get; set; }public string seotitle{ get; set; }public string seokeyword{ get; set; }public string seodescr{ get; set; }public int hit{ get; set; }public string summary{ get; set; }public string specialid{ get; set; }public string etdxml{ get; set; } /// <summary>/// 修改记录/// </summary>public string remark { get; set; }/// <summary>/// 购买数量/// </summary>public int quantity { get; set; }/// <summary>/// 市场价格/// </summary>public decimal marketprice { get; set; }/// <summary>/// 实际售价/// </summary>public decimal price { get; set; }/// <summary>/// 优惠截止时间/// </summary>public string endtime { get; set; }}public enum earticlelock{审核退回=-2,已删除 = -1,待审核 = 0,正常=1,已批复=2}}using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace Qing.Model{[Serializable][Table(Name = "order_goods")]public class Eorder_goods{[Id(Name = "id", Strategy = GenerationType.INDENTITY)]public int id{ get; set; }public int article_id{ get; set; }public int order_id{ get; set; }public string goods_no{ get; set; }public string goods_title{ get; set; }public string img_url{ get; set; }public string linkurl { get; set; }public string spec_text{ get; set; }public Decimal goods_price{ get; set; }public Decimal real_price{ get; set; }public int quantity{ get; set; }public int point{ get; set; }}}using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace Qing.Model{[Serializable][Table(Name = "orders")]public class Eorders{[Id(Name = "id", Strategy = GenerationType.INDENTITY)]public int id{ get; set; }public string order_no{ get; set; }public string trade_no{ get; set; }public int user_id{ get; set; }public string user_name{ get; set; }public int payment_id{ get; set; }[Column(IsInsert=false,IsUpdate=false)]public string paytitle { get; set; }public Decimal payment_fee{ get; set; }[Column(Ignore = true)]public epaystatus epay_status{get { return (epaystatus)payment_status; } set { payment_status = (int)value; }}public int payment_status{ get; set; }public string payment_time{ get; set; }public string express_title{ get; set; }public string express_no{ get; set; }public Decimal express_fee{ get; set; }public int express_status{ get; set; }public string express_time{ get; set; }public string accept_name{ get; set; }public string post_code{ get; set; }public string telphone{ get; set; }public string mobile{ get; set; }public string email{ get; set; }public string area{ get; set; }public string address{ get; set; }public string message{ get; set; }public string remark{ get; set; }public int is_invoice{ get; set; }public string invoice_title{ get; set; }public Decimal invoice_taxes{ get; set; }public Decimal payable_amount{ get; set; }public Decimal real_amount{ get; set; }public Decimal order_amount{ get; set; }public int point{ get; set; }public int status{ get; set; }[Column(IsInsert=false,IsUpdate=false)]public DateTime add_time{ get; set; }public string confirm_time{ get; set; }public string complete_time{ get; set; } }public enum epaystatus{线下付款 = 0,待支付 = 1,已支付}using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace Qing.Model{[Serializable][Table(Name = "payment")]public class Epayment{[Id(Name = "id", Strategy = GenerationType.INDENTITY)]public int id{ get; set; }public string title{ get; set; }public string img_url{ get; set; }public string remark{ get; set; }public int type{ get; set; }public string vesion { get; set; }public int poundage_type{ get; set; }public Decimal poundage_amount{ get; set; }public int sort_id{ get; set; }public int is_lock{ get; set; }public string api_path{ get; set; }/// <summary>/// 商户终端编码/// </summary>public string terminalId { get; set; }public string defaultpage { get; set; }/// <summary>/// 合作身份者ID/// </summary>public string partner { get; set; }public string md5key { get; set; }public string email { get; set; }public int unicode { get; set; }public string return_url { get; set; }public string notice_url { get; set; }}}using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace Qing.Model[Serializable][Table(Name = "bank")]public class Ebank{[Id(Name = "id", Strategy = GenerationType.INDENTITY)]public int id{ get; set; }/// <summary>/// 简称/// </summary>public string shortname { get; set; }public int btype{ get; set; }/// <summary>/// 银行名称/// </summary>public string name{ get; set; }public string icoimg{ get; set; }/// <summary>/// 开户行/// </summary>public string bankname{ get; set; }/// <summary>/// 收款人/// </summary>public string bankuser{ get; set; }public string bankid{ get; set; }public int taxis{ get; set; }public string bz{ get; set; }public string weburl{ get; set; }}}using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace Qing.Model{[Serializable][Table(Name = "view_article")]public class EVarticle{[Id(Name = "id", Strategy = GenerationType.INDENTITY)]public int id{ get; set; }public int nodeid{ get; set; }public string nodename { get; set; }/// <summary>/// 内容是否开启图片组/// </summary>public int istp { get; set; }/// <summary>/// 内容是否开启附件上传/// </summary>public int isfile { get; set; }/// <summary>/// 是否开启评论/// </summary>public int ispl { get; set; }public string ishtml { get; set; }[Column(IsUpdate = false)]public string adduser{ get; set; }public DateTime addtime{ get; set; }public string lastuser{ get; set; }[Column(IsInsert = false)]public DateTime lasttime { get; set; } public long taxis{ get; set; }public string title{ get; set; }public string subtitle{ get; set; }public string imgurl{ get; set; }public string linkurl{ get; set; }public int istj{ get; set; }public int istop{ get; set; }public int ispics{ get; set; }public int ishot{ get; set; }public int islock{ get; set; }public string content{ get; set; }public string author{ get; set; }public string source{ get; set; }public string seotitle{ get; set; }public string seokeyword{ get; set; }public string seodescr{ get; set; }public int hit{ get; set; }public string summary{ get; set; }public string specialid{ get; set; }public string etdxml{ get; set; }public int quantity { get; set; }public decimal marketprice { get; set; } public decimal price { get; set; }public string endtime { get; set; }}}using System;using System.Linq;using System.IO;using ;using System.Text;using System.Web.UI.WebControls;using System.Collections;using System.Collections.Generic;using System.Data;using System.Web;using System.Web.SessionState;using Qing.Site;using mon;using Qing.Model;using Qing.DAL;using Qing.DBUtility;using Qing.Session;namespace Qing.Web.tools{/// <summary>/// 管理后台AJAX处理页/// </summary>public class admin_ajax : IHttpHandler, IRequiresSessionState{private ParamMap _pm = ParamMap.newMap();protected Model.siteconfig siteConfig =DAL.xml<Model.siteconfig>.loadConfig("~/skin/xmlconfig/site.config"); protected Model.Euserconfig uconfig =DAL.xml<Model.Euserconfig>.loadConfig("~/skin/xmlconfig/user.config"); public void ProcessRequest(HttpContext context){//取得处事类型string action = r.GetQueryString("action");//判断管理员是否登录if (!er.Identity.IsAuthenticated){return;}switch (action){case "get_nav_list":get_nav_list(context);break;case "px":px(context);break;case "attribute_field_validate": //验证扩展字段是否重复attribute_field_validate(context);break;case "index_validate": //验证栏目索引是否重复index_validate(context);break;case "etdxml": //验证扩展字段是否重复etdxml(context);break;case "avatar":user_avatar_crop(context);break;case "edit_order_status": //修改订单信息和状态edit_order_status(context);break;case "downzip":downzip(context);break;}}#region 获取后台导航字符串==============================private void get_nav_list(HttpContext context){Site.BasePage bp = new BasePage();string querysql = " select * from navigation where islock=0 and classlayer<4 order by classlayer,pid,taxis,id";string p0str = "<div class=\"list-group\"name=\"{0}\" ><ul>{1}</ul></div>";string p1str = " <li><a class=\"item pack\"><div class=\"arrow\"><i class=\"{0}\"></i></div><span>{1}</span></a><ul>{2}</ul></li> ";string str = "<li><a href=\"{0}\" target=\"mainframe\"class=\"item\"><div class=\"folder\"></div><span>{1}</span></a></li>";StringBuilder sb = new StringBuilder();List<Enavigation> list = new DALty().GetListAll<Enavigation>(querysql,"", false); foreach (Enavigation m1 in list.FindAll(i => i.classlayer == 1)){string str1 = string.Empty;foreach (Enavigation m2 in list.FindAll(i => i.classlayer == 2 && i.pid == m1.id)) {string str2 = string.Empty;foreach (Enavigation m in list.FindAll(i => i.classlayer == 3 && i.pid == m2.id)) {if(bp.HasPermission(m.roleattr))str2 += string.Format(str, m.linkurl, m.title);}if(str2!="")str1 += string.Format(p1str, m2.cssstyle, m2.title, str2);}if(str1!="")sb.Append(string.Format(p0str, m1.title, str1));}context.Response.Write(sb.ToString());}#endregion#region 排序==============================private void px(HttpContext context){int id = r.GetFormInt("id");int type = r.GetFormInt("type");string table = r.GetFormString("table",true);long px = Convert.ToInt64(r.GetFormString("px"));long px2 = 0;int id2 = 0;if (id == 0 || string.IsNullOrEmpty(table)){context.Response.Write("{\"status\": 0, \"msg\": \"id错误\"}");return;}if (type == 0){id2 = r.GetFormInt("pid");px2 = Convert.ToInt64(r.GetFormString("ppx")); }else{id2 = r.GetFormInt("nid");px2 = Convert.ToInt64(r.GetFormString("npx")); }if (px == px2){px += 1;}_pm.setParameter("key_taxis", px2);_pm.setParameter("key_id", id);_pm.setParameter("key_taxis2", px);_pm.setParameter("key_id2", id2);new DALty().ExcuteSQL("update "+table+" set taxis=@key_taxis whereid=@key_id;update "+table+" set taxis=@key_taxis2 where id=@key_id2",_pm);context.Response.Write("{\"status\": 1, \"msg\": \"ok\"}");return;}#endregion#region 验证扩展字段是否重复============================private void attribute_field_validate(HttpContext context){string column_name = r.GetString("param");if (string.IsNullOrEmpty(column_name)){context.Response.Write("{ \"info\":\"名称不可为空\",\"status\":\"n\" }");return;}if (new DALty().exists("tablestyle",column_name,"name")){context.Response.Write("{ \"info\":\"该名称已被占用,请更换!\", \"status\":\"n\" }");return;}context.Response.Write("{ \"info\":\"该名称可使用\",\"status\":\"y\" }");return;}#endregion#region 索引是否重复============================private void index_validate(HttpContext context){string column_name = r.GetString("param");if (!string.IsNullOrEmpty(column_name)){if (new DALty().exists("nodes", column_name, "channelindex")){context.Response.Write("{ \"info\":\"该名称重复,请更换!\", \"status\":\"n\" }");return;}context.Response.Write("{ \"info\":\"\", \"status\":\"y\" }"); }return;}#endregion#region 创建、赋值扩展字段============================private void etdxml(HttpContext context){int id = r.GetQueryInt("id");int chid = r.GetQueryInt("chid");string table = r.GetQueryString("table");_pm.setParameter("tablename", table);List<Etablestyle> ls = new DALty().GetListAll<Etablestyle>("", _pm); if (ls.Count == 0) return;Hashtable hs = new Hashtable();if (id > 0){Model.Earticles model = new DALty().GetModel<Earticles>(id.ToString()); if (model == null) return;if (!string.IsNullOrEmpty(model.etdxml)){string[] va = model.etdxml.Split('&');foreach (string s in va){if (s == null) break;string[] v = s.Split('=');hs.Add(v[0], v[1]);}}}//读取自定义字段信息string tmpInfoBase = "<dl><dt>{0}:</dt><dd>{1}{2}</dd></dl> \r\n";StringBuilder tmpInfo = new StringBuilder();string _html = string.Empty ;StringBuilder sbl = new StringBuilder();foreach (Etablestyle modelt in ls){sbl.Clear();object _value = modelt.default_value;if (id > 0)_value = hs[];string _vld = "<span class=\"Validform_checktip\">" +modelt.valid_tip_msg + "</span>";switch (modelt.control_type){case "single-text": //单行文本case "number": //数字case "multi-text":case "images": //图片上传case "editor": //编辑器case "date":_html = string.Format("<input name=\"{0}\" type=\"text\" value=\"{1}\" id=\"{0}\" class=\"*&*\" datatype=\"{2}\" errormsg=\"{3}\"tipmsg=\"{4}\" >", , _value, modelt.valid_pattern, modelt.valid_error_msg, modelt.valid_tip_msg);string css = string.Empty;if (modelt.control_type == "single-text") //单行{css = "input normal";}else if (modelt.control_type == "multi-text") //多行{_html = _html.Replace("<input", "<textarea") + (id > 0 ?hs[] : modelt.default_value) + "</textarea>";_html = _html.Replace("*&*", "input\" rows=\"2\" cols=\"20\"\""); }else if (modelt.control_type == "editor") //编辑器{_html = _html.Replace("<input", "<textareastyle=\"visibility:hidden;display: none;\"") + (id > 0 ? hs[] :modelt.default_value) + "</textarea>";css = "editor";}else if (modelt.control_type == "number") //数字{css = "input small";}else if (modelt.control_type == "date") //日期{css = string.Format("input date\"onClick=WdatePicker({0}) \"", modelt.default_value == "" ? "" : "{dateFmt:\"" + modelt.default_value + "\"}");_html ="<div class=\"input-date\">"+ _html + "<i>日期</i></div>"; }else if (modelt.control_type == "images") //图片{css = "input normal upload-path";_html += "<input type=\"button\" class=\"xbtnupload-img\" style=\"margin-left:5px;\" value=\"上传图片\">";}_html = _html.Replace("*&*", css);break;case "checkbox": //复选框_html = string.Format("<divclass=\"rule-single-checkbox\"><input id=\"{0}\" type=\"checkbox\" name=\"{0}\" {1}></div>",, _value.ToString() == "on" ? "checked=checked" : ""); break;case "multi-radio": //多项单选sbl.Append(string.Format("<divclass=\"rule-multi-radio\"><span id=\"{0}\" name={0}>", ));string[] valArr = modelt.item_option.Split(new string[] { "\r\n", "\n" }, StringSplitOptions.None);for (int i = 0; i < valArr.Length; i++){string[] valItemArr = valArr[i].Split('|');if (valItemArr.Length == 2){sbl.Append(string.Format("<input id=\"{0}_{1}\" type=\"radio\" name=\"{0}\" value=\"{2}\" {3} > <label for=\"{0}_{1}\">{4}</label>",, i, valItemArr[1], _value.ToString() == valItemArr[1] ? "checked=checked" : "", valItemArr[0]));}}sbl.Append("</span></div>");_html = sbl.ToString();break;case "dropdownlist": //下拉列表sbl.Append(string.Format("<divclass=\"rule-single-select\"><select id=\"{0}\" name={0}>", ));valArr = modelt.item_option.Split(new string[] { "\r\n", "\n" }, StringSplitOptions.None);for (int i = 0; i < valArr.Length; i++){string[] valItemArr = valArr[i].Split('|');if (valItemArr.Length == 2){sbl.Append(string.Format("<option value=\"{0}\" {1}>{2}</option>", valItemArr[1], _value.ToString() == valItemArr[1] ?"selected=selected" : "", valItemArr[0]));}}sbl.Append("</select></div>");_html = sbl.ToString();break;case "multi-checkbox": //多项多选sbl.Append(string.Format("<divclass=\"rule-multi-checkbox\" ><span id=\"{0}\" name={0}>", ));valArr = modelt.item_option.Split(new string[] { "\r\n", "\n" }, StringSplitOptions.None);_value = "," + _value + ",";for (int i = 0; i < valArr.Length; i++){string[] valItemArr = valArr[i].Split('|');if (valItemArr.Length == 2){sbl.Append(string.Format("<input type=\"checkbox\"name=\"{0}\" value=\"{1}\" {2} ><label for=\"{0}\">{3}</label> ",, valItemArr[1], _value.ToString().IndexOf("," + valItemArr[1] + ",") > -1 ? "checked=checked" : "", valItemArr[0]));}}sbl.Append("</span></div>");_html = sbl.ToString();break;}tmpInfo.Append(string.Format(tmpInfoBase, modelt.title, _html, _vld)); }context.Response.Write(tmpInfo.ToString());return;}#endregion#region 确认裁剪用户头像=============================private void user_avatar_crop(HttpContext context){//检查用户是否登录Model.EVuser model = new BasePage().getEuser();string fileName = r.GetFormString("hideFileName");int x1 = r.GetFormInt("hideX1");int y1 = r.GetFormInt("hideY1");int w = r.GetFormInt("hideWidth");int h = r.GetFormInt("hideHeight");//检查是否图片//检查参数if (!u.FileExists(fileName) || w == 0 || h == 0){context.Response.Write("{\"status\":0, \"msg\":\"对不起,请先上传一张图片!\"}"); return;}//取得保存的新文件名UpLoad upFiles = new UpLoad();bool result = upFiles.cropSaveAs(fileName, fileName, 180, 180, w, h, x1, y1); if (!result){context.Response.Write("{\"status\": 0, \"msg\": \"图片裁剪过程中发生意外错误!\"}");return;}//删除原用户头像u.DeleteFile(model.avatar);new DALty().ExcuteSQL(string.Format("update users set avatar='{0}' where username='{1}'", fileName, ername));context.Session["user"] = null;context.Response.Write("{\"status\": 1, \"msg\": \"头像上传成功!\", \"avatar\": \"" + fileName + "\"}");return;}#endregion#region 修改订单信息和状态==============================private void edit_order_status(HttpContext context){//取得订单配置信息Eorderconfig orderConfig =DAL.xml<Eorderconfig>.loadConfig("~/skin/xmlconfig/order.config");BasePage bp = new BasePage();string order_no = r.GetString("order_no");string edit_type = r.GetString("edit_type");if (order_no == ""){context.Response.Write("{\"status\": 0, \"msg\": \"传输参数有误,无法获取订单号!\"}");return;}if (edit_type == ""){context.Response.Write("{\"status\": 0, \"msg\": \"无法获取修改订单类型!\"}");return;}Eorders model = new DALty().GetModel<Eorders>(order_no,"order_no");if (model == null){context.Response.Write("{\"status\": 0, \"msg\": \"订单号不存在或已被删除!\"}");return;}DALty bll = new DALty();string _moduleName = "order";string _action = "edit";//检查权限switch (edit_type.ToLower()){case "order_confirm": //确认订单if (model.status > 1){context.Response.Write("{\"status\": 0, \"msg\": \"订单已经确认,不能重复处理!\"}");return;}model.status = 2;model.confirm_time = DateTime.Now;if (bll.Update(model)<1){context.Response.Write("{\"status\": 0, \"msg\": \"订单确认失败!\"}");return;}bp.savelog(_moduleName, _action, "确认订单号:" + model.order_no);#region 发送短信或邮件============================if (orderConfig.confirmmsg > 0){sendmsg("order_confirm", pletemsg, model); }#endregioncontext.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功!\"}"); break;case "order_payment": //确认付款if (model.status > 1 || model.payment_status == 2){context.Response.Write("{\"status\": 0, \"msg\": \"订单已确认,不能重复处理!\"}");return;}model.payment_status = 2;model.payment_time = DateTime.Now;model.status = 2;model.confirm_time = DateTime.Now;。