/* this is called instead of sys_main() to start things */ void libpd_init(void) { signal(SIGFPE, SIG_IGN); libpd_start_message(32); // allocate array for message assembly //printf ( "%p\n", &libpd_printhook ); sys_printhook = (t_printhook) libpd_printhook; sys_soundin = NULL; sys_soundout = NULL; // are all these settings necessary? sys_schedblocksize = DEFDACBLKSIZE; sys_externalschedlib = 0; sys_printtostderr = 0; sys_usestdpath = 0; // don't use pd_extrapath, only sys_searchpath sys_debuglevel = 0; sys_verbose = 0; sys_noloadbang = 0; sys_nogui = 1; sys_hipriority = 0; sys_nmidiin = 0; sys_nmidiout = 0; sys_time = 0; pd_init(); libpdreceive_setup(); sys_set_audio_api(API_DUMMY); sys_searchpath = NULL; }
void ThreadLocalStorage::init() { assert(!is_initialized(), "More than one attempt to initialize threadLocalStorage"); pd_init(); set_thread_index(os::allocate_thread_local_storage()); generate_code_for_get_thread(); }
/* this is called from main() in s_entry.c */ int sys_main(int argc, char **argv) { int i, noprefs; sys_externalschedlib = 0; sys_extraflags = 0; #ifdef PD_DEBUG fprintf(stderr, "Pd: COMPILED FOR DEBUGGING\n"); #endif /* use Win32 "binary" mode by default since we don't want the * translation that Win32 does by default */ #ifdef _WIN32 # ifdef _MSC_VER /* MS Visual Studio */ _set_fmode( _O_BINARY ); # else /* MinGW */ { extern int _fmode; _fmode = _O_BINARY; } # endif /* _MSC_VER */ #endif /* WIN32 */ pd_init(); /* start the message system */ sys_findprogdir(argv[0]); /* set sys_progname, guipath */ for (i = noprefs = 0; i < argc; i++) /* prescan args for noprefs */ if (!strcmp(argv[i], "-noprefs")) noprefs = 1; if (!noprefs) sys_loadpreferences(); /* load default settings */ #ifndef _WIN32 if (!noprefs) sys_rcfile(); /* parse the startup file */ #endif if (sys_argparse(argc-1, argv+1)) /* parse cmd line */ return (1); sys_afterargparse(); /* post-argparse settings */ if (sys_verbose || sys_version) fprintf(stderr, "%s compiled %s %s\n", pd_version, pd_compiletime, pd_compiledate); if (sys_version) /* if we were just asked our version, exit here. */ return (0); sys_setsignalhandlers(); if (sys_startgui(sys_libdir->s_name)) /* start the gui */ return (1); if (sys_externalschedlib) return (sys_run_scheduler(sys_externalschedlibname, sys_extraflagsstring)); else if (sys_batch) return (m_batchmain()); else { /* open audio and MIDI */ sys_reopen_midi(); if (audio_shouldkeepopen()) sys_reopen_audio(); /* run scheduler until it quits */ return (m_mainloop()); } }
int init_module(void) { #ifdef PARIDE_JUMBO { extern paride_init(); paride_init(); } #endif return pd_init(); }
static void pd_brelse(struct exfat_parse_data *pd) { while (pd->nr_bhs) { pd->nr_bhs--; brelse(pd->bhs[pd->nr_bhs]); #ifdef DEBUG pd->bh_cnt--; #endif } pd_init(pd); }
void ipd_init(I_PEAK_DETECTOR* detector, PEAK_VALUE delta) { // Initialise detector variables detector->integrator[0] = 0; detector->integrator[1] = 0; detector->hold[0] = 0; detector->hold[1] = 0; detector->output[0] = 0; detector->output[1] = 0; detector->last_state = PD_STATE_T_RISE; pd_init(&detector->detector,delta); }
int main(void) { int r; DEBUG_PRINT(banner); #if defined(ARCH_ARM) && ARCH_VER <= 5 /* Place iguana in L4 ARM vspace #1 */ (void)L4_SpaceControl(IGUANA_SPACE, L4_SpaceCtrl_resources, IGUANA_CLIST, L4_Nilpage, (1 << 16), NULL); /* Cache Flush */ (void)L4_CacheFlushAll(); #endif INIT_PRINT("Processing Boot Info: %p\n", __okl4_bootinfo); utcb_init(); mutex_init(); space_init(); pd_init(); objtable_init(); thread_init(); r = bi_execute(__okl4_bootinfo); if (r != 0) { #if defined(IGUANA_DEBUG) L4_KDB_Enter("PANIC: Bootinfo did not initialise correctly"); #endif while (1); } extensions_init(); /* * TODO: We could reclaim memory here is we need to */ /* Now that we are ready to roll, lets start the server */ INIT_PRINT("iguana_server\n"); iguana_server_loop(); assert(!"Should never reach here"); return 0; }
/* this is called instead of sys_main() to start things */ int libpd_init(void) { static int initialized = 0; if (initialized) return -1; // only allow init once (for now) initialized = 1; signal(SIGFPE, SIG_IGN); libpd_start_message(32); // allocate array for message assembly sys_printhook = (t_printhook) libpd_printhook; sys_soundin = NULL; sys_soundout = NULL; // are all these settings necessary? sys_schedblocksize = DEFDACBLKSIZE; sys_externalschedlib = 0; sys_printtostderr = 0; sys_usestdpath = 0; // don't use pd_extrapath, only sys_searchpath sys_debuglevel = 0; sys_verbose = 0; sys_noloadbang = 0; sys_nogui = 1; sys_hipriority = 0; sys_nmidiin = 0; sys_nmidiout = 0; sys_init_fdpoll(); #ifdef HAVE_SCHED_TICK_ARG sys_time = 0; #endif pd_init(); libpdreceive_setup(); sys_set_audio_api(API_DUMMY); sys_searchpath = NULL; #ifdef LIBPD_EXTRA bob_tilde_setup(); bonk_tilde_setup(); choice_setup(); expr_setup(); fiddle_tilde_setup(); loop_tilde_setup(); lrshift_tilde_setup(); pique_setup(); sigmund_tilde_setup(); stdout_setup(); #endif return 0; }
/* this is called from main() in s_entry.c */ int sys_main(int argc, char **argv) { int i, noprefs; sys_externalschedlib = 0; sys_extraflags = 0; #ifdef PD_DEBUG fprintf(stderr, "Pd: COMPILED FOR DEBUGGING\n"); #endif pd_init(); /* start the message system */ logpost(NULL, 2, "PD_FLOATPRECISION = %lu bits", sizeof(t_float)*8); sys_findprogdir(argv[0]); /* set sys_progname, guipath */ for (i = noprefs = 0; i < argc; i++) /* prescan args for noprefs */ if (!strcmp(argv[i], "-noprefs")) noprefs = 1; if (!noprefs) sys_loadpreferences(); /* load default settings */ #ifndef MSW if (!noprefs) sys_rcfile(); /* parse the startup file */ #endif if (sys_argparse(argc-1, argv+1)) /* parse cmd line */ return (1); sys_afterargparse(); /* post-argparse settings */ if (sys_verbose || sys_version) fprintf(stderr, "%s compiled %s %s\n", pd_version, pd_compiletime, pd_compiledate); if (sys_version) /* if we were just asked our version, exit here. */ return (0); if (sys_startgui(sys_libdir->s_name)) /* start the gui */ return(1); if (sys_externalschedlib) return (sys_run_scheduler(sys_externalschedlibname, sys_extraflagsstring)); else if (sys_batch) return (m_batchmain()); else { /* open audio and MIDI */ sys_reopen_midi(); sys_reopen_audio(); /* run scheduler until it quits */ return (m_mainloop()); } }
Pd::Pd() noexcept { signal(SIGFPE, SIG_IGN); sys_printhook = NULL; sys_soundin = NULL; sys_soundout = NULL; // are all these settings necessary? sys_schedblocksize = DEFDACBLKSIZE; sys_externalschedlib = 0; sys_printtostderr = 0; sys_usestdpath = 0; sys_debuglevel = 1; sys_verbose = 1; sys_noloadbang = 0; sys_nogui = 1; sys_hipriority = 0; sys_nmidiin = 0; sys_nmidiout = 0; sys_init_fdpoll(); #ifdef HAVE_SCHED_TICK_ARG sys_time = 0; #endif pd_init(); sys_set_audio_api(API_DUMMY); sys_searchpath = NULL; m_sample_rate = 0; int indev[MAXAUDIOINDEV], inch[MAXAUDIOINDEV], outdev[MAXAUDIOOUTDEV], outch[MAXAUDIOOUTDEV]; indev[0] = outdev[0] = DEFAULTAUDIODEV; inch[0] = m_max_channels; outch[0] = m_max_channels; sys_set_audio_settings(1, indev, 1, inch, 1, outdev, 1, outch, 44100, -1, 1, DEFDACBLKSIZE); sched_set_using_audio(SCHED_AUDIO_CALLBACK); sys_reopen_audio(); m_sample_rate = sys_getsr(); m_console.clear(); m_console.push_back({"Camomile " + getVersion()+" for Pure Data "+getPdVersion()+"\n", Post::Type::Log}); m_console_changed = true; sys_printhook = reinterpret_cast<t_printhook>(print); }
// creation C1_MacroAssembler(CodeBuffer* code) : MacroAssembler(code) { pd_init(); }
void cpd_init() { int devices = 0; int ioputs = 2; static char initialized = 0; assert("Pure Data is already initialized." && !initialized); if(!initialized) { cpd_mutex_init(&c_mutex); sys_soundin = NULL; sys_soundout = NULL; c_current_instance = NULL; sys_printhook = (t_printhook)(cpd_print); signal(SIGFPE, SIG_IGN); sys_soundin = NULL; sys_soundout = NULL; sys_schedblocksize = DEFDACBLKSIZE; sys_externalschedlib = 0; sys_printtostderr = 0; sys_usestdpath = 0; sys_debuglevel = 1; sys_verbose = 4; sys_noloadbang = 0; sys_nogui = 1; sys_hipriority = 0; sys_nmidiin = 0; sys_nmidiout = 0; sys_init_fdpoll(); pd_init(); sys_startgui(NULL); sys_set_audio_api(API_DUMMY); sys_searchpath = NULL; sys_set_audio_settings(1, &devices, 1, &ioputs, 1, &devices, 1, &ioputs, 44100, -1, 1, DEFDACBLKSIZE); sched_set_using_audio(SCHED_AUDIO_CALLBACK); sys_reopen_audio(); c_sample_ins = sys_soundin; c_sample_outs = sys_soundout; c_first_instance = pd_this; c_sym_bng = gensym("bng"); c_sym_hsl = gensym("hsl"); c_sym_vsl = gensym("vsl"); c_sym_tgl = gensym("tgl"); c_sym_nbx = gensym("nbx"); c_sym_vradio = gensym("vradio"); c_sym_hradio = gensym("hradio"); c_sym_vu = gensym("vu"); c_sym_cnv = gensym("cnv"); c_sym_empty = gensym("empty"); bob_tilde_setup(); bonk_tilde_setup(); choice_setup(); fiddle_tilde_setup(); loop_tilde_setup(); lrshift_tilde_setup(); pique_setup(); sigmund_tilde_setup(); stdout_setup(); initialized = 1; } }
/* this is called from main() in s_entry.c */ int sys_main(int argc, char **argv) { int i, noprefs; char *prefsfile = ""; sys_externalschedlib = 0; sys_extraflags = 0; #ifdef PD_DEBUG fprintf(stderr, "Pd: COMPILED FOR DEBUGGING\n"); #endif /* use Win32 "binary" mode by default since we don't want the * translation that Win32 does by default */ #ifdef _WIN32 # ifdef _MSC_VER /* MS Visual Studio */ _set_fmode( _O_BINARY ); # else /* MinGW */ { extern int _fmode; _fmode = _O_BINARY; } # endif /* _MSC_VER */ #endif /* _WIN32 */ #ifndef _WIN32 /* long ago Pd used setuid to promote itself to real-time priority. Just in case anyone's installation script still makes it setuid, we complain to stderr and lose setuid here. */ if (getuid() != geteuid()) { fprintf(stderr, "warning: canceling setuid privilege\n"); setuid(getuid()); } #endif /* _WIN32 */ pd_init(); /* start the message system */ sys_findprogdir(argv[0]); /* set sys_progname, guipath */ for (i = noprefs = 0; i < argc; i++) /* prescan for prefs override */ { if (!strcmp(argv[i], "-noprefs")) noprefs = 1; else if (!strcmp(argv[i], "-prefsfile") && i < argc-1) prefsfile = argv[i+1]; } if (!noprefs) /* load preferences before parsing args to allow ... */ sys_loadpreferences(prefsfile, 1); /* args to override prefs */ if (sys_argparse(argc-1, argv+1)) /* parse cmd line args */ return (1); sys_afterargparse(); /* post-argparse settings */ if (sys_verbose || sys_version) fprintf(stderr, "%s compiled %s %s\n", pd_version, pd_compiletime, pd_compiledate); if (sys_version) /* if we were just asked our version, exit here. */ return (0); sys_setsignalhandlers(); if (sys_dontstartgui) clock_set((sys_fakefromguiclk = clock_new(0, (t_method)sys_fakefromgui)), 0); else if (sys_startgui(sys_libdir->s_name)) /* start the gui */ return (1); if (sys_hipriority) sys_setrealtime(sys_libdir->s_name); /* set desired process priority */ if (sys_externalschedlib) return (sys_run_scheduler(sys_externalschedlibname, sys_extraflagsstring)); else if (sys_batch) return (m_batchmain()); else { /* open audio and MIDI */ sys_reopen_midi(); if (audio_shouldkeepopen()) sys_reopen_audio(); /* run scheduler until it quits */ return (m_mainloop()); } }
void freevms_main(void) { char *command_line; # define ROOT_DEVICE_LENGTH 80 char root_device[ROOT_DEVICE_LENGTH]; # define CONSOLE_DEVICE_LENGTH 80 char console_device[CONSOLE_DEVICE_LENGTH]; L4_BootRec_t *boot_record; L4_KernelInterfacePage_t *kip; L4_ProcDesc_t *main_proc_desc; L4_ThreadId_t root_tid; L4_ThreadId_t s0_tid; L4_Word_t api_flags; L4_Word_t boot_info; L4_Word_t i; L4_Word_t kernel_id; L4_Word_t kernel_interface; L4_Word_t num_boot_info_entries; L4_Word_t num_processors; L4_Word_t page_bits; L4_Word_t pagesize; struct vms$meminfo mem_info; vms$pd_initialized = 0; notice("\n"); notice(">>> FreeVMS %s (R)\n", FREEVMS_VERSION); notice("\n"); kip = (L4_KernelInterfacePage_t *) L4_KernelInterface(&kernel_interface, &api_flags, &kernel_id); notice(SYSBOOT_I_SYSBOOT "leaving kernel privileges\n"); notice(SYSBOOT_I_SYSBOOT "launching FreeVMS kernel with executive " "privileges\n"); root_tid = L4_Myself(); s0_tid = L4_GlobalId(kip->ThreadInfo.X.UserBase, 1); notice(SYSBOOT_I_SYSBOOT "booting main processor\n"); for(page_bits = 0; !((1 << page_bits) & L4_PageSizeMask(kip)); page_bits++); pagesize = (((vms$pointer) 1) << page_bits); notice(SYSBOOT_I_SYSBOOT "computing page size: %d bytes\n", (int) pagesize); num_processors = L4_NumProcessors((void *) kip); switch(num_processors - 1) { case 0: break; case 1: notice(SYSBOOT_I_SYSBOOT "booting %d secondary processor\n", (int) (num_processors - 1)); break; default: notice(SYSBOOT_I_SYSBOOT "booting %d secondary processors\n", (int) (num_processors - 1)); break; } for(i = 0; i < num_processors; i++) { main_proc_desc = L4_ProcDesc((void *) kip, i); notice(SYSBOOT_I_SYSBOOT "CPU%d EXTFREQ=%d MHz, INTFREQ=%d MHz\n", (int) i, (int) (main_proc_desc->X.ExternalFreq / 1000), (int) (main_proc_desc->X.InternalFreq / 1000)); } L4_Sigma0_GetPage(L4_nilthread, L4_Fpage(L4_BootInfo(kip), pagesize)); boot_info = L4_BootInfo((void *) kip); num_boot_info_entries = L4_BootInfo_Entries((void *) boot_info); boot_record = L4_BootInfo_FirstEntry((void *) boot_info); for(i = 2; i < num_boot_info_entries; i++) { PANIC(L4_BootRec_Type(boot_record) != L4_BootInfo_SimpleExec); command_line = L4_SimpleExec_Cmdline(boot_record); if ((strstr(command_line, "vmskernel.sys") != NULL) && (i == 3)) { break; } boot_record = L4_BootRec_Next(boot_record); } PANIC(L4_BootRec_Type(boot_record) != L4_BootInfo_SimpleExec); command_line = L4_SimpleExec_Cmdline(boot_record); notice(SYSBOOT_I_SYSBOOT "parsing command line: %s\n", command_line); sys$parsing(command_line, (char *) "root", root_device, ROOT_DEVICE_LENGTH); notice(SYSBOOT_I_SYSBOOT "selecting root device: %s\n", root_device); sys$parsing(command_line, (char *) "console", console_device, CONSOLE_DEVICE_LENGTH); notice(SYSBOOT_I_SYSBOOT "selecting console device: %s\n", console_device); dbg$virtual_memory = (strstr(command_line, " dbg$virtual_memory") != NULL) ? 1 : 0; dbg$sys_pagefault = (strstr(command_line, " dbg$sys_pagefault") != NULL) ? 1 : 0; dbg$vms_pagefault = (strstr(command_line, " dbg$vms_pagefault") != NULL) ? 1 : 0; // Starting virtual memory subsystem sys$mem_init(kip, &mem_info, pagesize); sys$bootstrap(&mem_info, pagesize); sys$objtable_init(); sys$utcb_init(kip); sys$pd_init(&mem_info); sys$thread_init(kip); sys$populate_init_objects(&mem_info, pagesize); dev$init(); names$init(); sys$pager(kip, &mem_info, pagesize, root_device); sys$init(kip, &mem_info, pagesize, root_device); sys$loop(); notice(">>> System halted\n"); return; }
/* this is called from main() in s_entry.c */ int sys_main(int argc, char **argv) { int i, noprefs; sys_externalschedlib = 0; sys_extraflags = 0; char * filenames; #ifdef PD_DEBUG fprintf(stderr, "Pd-L2Ork: COMPILED FOR DEBUGGING\n"); #endif pd_init(); /* start the message system */ sys_findprogdir(argv[0]); /* set sys_progname, guipath */ for (i = noprefs = 0; i < argc; i++) /* prescan args for noprefs */ if (!strcmp(argv[i], "-noprefs")) noprefs = 1; if (!noprefs) sys_loadpreferences(); /* load default settings */ #ifndef MSW if (!noprefs) sys_rcfile(); /* parse the startup file */ #endif if (sys_argparse(argc-1, argv+1)) /* parse cmd line */ return (1); sys_afterargparse(); /* post-argparse settings */ /* build version string from defines in m_pd.h */ pd_makeversion(); if (sys_verbose || sys_version) fprintf(stderr, "%scompiled %s %s\n", pd_version, pd_compiletime, pd_compiledate); if (sys_version) /* if we were just asked our version, exit here. */ return (0); if (sys_startgui(sys_guidir->s_name)) /* start the gui */ return(1); /* check if we are unique, otherwise, just focus existing instance, and if necessary open file inside it */\ if (sys_openlist) { // let's create one continuous string from all files int length = 0; t_namelist *nl; for (nl = sys_openlist; nl; nl = nl->nl_next) length = length + strlen(nl->nl_string) + 1; if((filenames = malloc(length)) != NULL) { filenames[0] = '\0'; // ensures the memory is an empty string if (sys_openlist) { for (nl = sys_openlist; nl; nl = nl->nl_next) { strcat(filenames,nl->nl_string); if (nl->nl_next) strcat(filenames," "); } } //fprintf(stderr,"final list: <%s>\n", filenames); } else { error("filelist malloc failed!\n"); return(1); } } sys_vgui("pdtk_check_unique %d %s\n", sys_unique, (filenames ? filenames : "0")); if (sys_externalschedlib) return (sys_run_scheduler(sys_externalschedlibname, sys_extraflagsstring)); else if (sys_batch) return (m_batchmain()); else { /* open audio and MIDI */ sys_reopen_midi(); sys_reopen_audio(); if (sys_console) sys_vgui("pdtk_toggle_console 1\n"); if (sys_k12_mode) { t_namelist *path = pd_extrapath; while (path->nl_next) path = path->nl_next; sys_vgui("pdtk_enable_k12_mode %s\n", path->nl_string); } /* run scheduler until it quits */ return (m_mainloop()); } }