void amiga_sockinit() { if ((SocketBase = OpenLibrary("bsdsocket.library", 1L)) == NULL) { printf("Error opening bsdsocket.library\n"); exit(10); } SetErrnoPtr(&errno, sizeof(errno)); }
// Run the update module void startup_run_update() { struct Library *ModuleBase; #ifdef __amigaos4__ struct ModuleIFace *IModule; #endif // Try and get update.module #ifdef __amigaos4__ if (OpenLibIFace("dopus5:modules/update.module", (APTR)&ModuleBase, (APTR)&IModule, LIB_VERSION)) #else if ((ModuleBase=OpenLibrary("dopus5:modules/update.module",0))) #endif { // Launch update function Module_Entry(0,0,0,0,0,0); // Expunge library Module_Expunge(); // Close library #ifdef __amigaos4__ DropInterface((struct Interface *)IModule); #endif CloseLibrary(ModuleBase); } }
void main(int argc, char *argv[]) { int nodnr, state = 0, i; if(argc < 2) { puts("Usage: SetNodeState <nodenr> [SERCLOSED] [NOANSWER] [LOGOUT]"); return; } nodnr = atoi(argv[1]); for(i = 2; i < argc; i++) { if(!stricmp(argv[i],"SERCLOSED")) { state |= NIKSTATE_CLOSESER; } if(!stricmp(argv[i],"NOANSWER")) { state |= NIKSTATE_NOANSWER; } if(!stricmp(argv[i],"LOGOUT")) { state |= NIKSTATE_LOGOUT; } } if(NiKomBase = OpenLibrary("nikom.library",0)) { if(SetNodeState(nodnr,state)) { puts("Suceeded"); } else { puts("Failed"); } CloseLibrary(NiKomBase); } else { puts("Kunde inte öppna nikom.library"); } }
int main(int argc, char **argv) { struct PartitionHandle *root; char *device = "fdsk.device"; ULONG unit = 1; if (argc > 2) { device = argv[1]; unit = atoi(argv[2]); } PartitionBase = (struct PartitionBase *)OpenLibrary("partition.library", 1); if (PartitionBase) { root = OpenRootPartition(device, unit); if (root) { printf("got root handle of %s unit %d\n", device, (int)unit); if (PrintPartitionTable(root, 0)) printf("Couldn't read partition table\n"); CloseRootPartition(root); } else printf("No root handle for %s unit %d\n", device, (int)unit); CloseLibrary((struct Library *)PartitionBase); } else printf("No partition.library\n"); return 0; }
void amiga_sockinit() { if ((SockBase = OpenLibrary("socket.library", 1L)) == NULL) { printf("Error opening socket.library\n"); exit(10); } setup_sockets(MAXSOCKS, &errno); }
// Open a module struct Library *OpenModule(char *name) { struct Library *lib = NULL; char buf[256]; short a,ver=0; // See if this is one of our modules for (a=0;dopus_modules[a];a++) if (stricmp(name,dopus_modules[a])==0) { // Need newest version ver=LIB_VERSION; break; } /* We can't check for valid modules in a LIBS: multiassign etc. // See if it's in RAM if ((lib=OpenLibrary(name,ver))) return lib; */ // Build name in modules directory strcpy(buf,"dopus5:modules/"); strcat(buf,name); // Open library if (!(lib=OpenLibrary(buf,ver))) { // Show error error_request(GUI->window,1,GetString(&locale,MSG_OPENING),-1,name,0); } return lib; }
/* /// "usbReleaseInterfaceBinding()" */ void usbReleaseInterfaceBinding(struct NepHidBase *nh, struct NepClassHid *nch) { struct Library *ps; struct PsdConfig *pc; struct PsdDevice *pd; STRPTR devname; KPRINTF(1, ("nepHidReleaseInterfaceBinding(%08lx)\n", nch)); if((ps = OpenLibrary("poseidon.library", 4))) { Forbid(); nch->nch_ReadySignal = SIGB_SINGLE; nch->nch_ReadySigTask = FindTask(NULL); if(nch->nch_Task) { Signal(nch->nch_Task, SIGBREAKF_CTRL_C); } Permit(); while(nch->nch_Task) { Wait(1L<<nch->nch_ReadySignal); } //FreeSignal(nch->nch_ReadySignal); psdGetAttrs(PGA_INTERFACE, nch->nch_Interface, IFA_Config, &pc, TAG_END); psdGetAttrs(PGA_CONFIG, pc, CA_Device, &pd, TAG_END); psdGetAttrs(PGA_DEVICE, pd, DA_ProductName, &devname, TAG_END); psdAddErrorMsg(RETURN_OK, (STRPTR) libname, "'%s' fell silent!", devname); psdFreeVec(nch); CloseLibrary(ps); } }
AROS_UFH3(DEVBASETYPEPTR, devInit, AROS_UFHA(DEVBASETYPEPTR, base, D0), AROS_UFHA(BPTR, seglist, A0), AROS_UFHA(struct ExecBase *, SysBase, A6)) { AROS_USERFUNC_INIT KPRINTF(10, ("devInit base: 0x%08lx seglist: 0x%08lx SysBase: 0x%08lx\n", base, seglist, SysBase)); base->np_Library.lib_Node.ln_Type = NT_DEVICE; base->np_Library.lib_Node.ln_Name = DEVNAME; base->np_Library.lib_Flags = LIBF_SUMUSED|LIBF_CHANGED; base->np_Library.lib_Version = VERSION_NUMBER; base->np_Library.lib_Revision = REVISION_NUMBER; base->np_Library.lib_IdString = VERSION_STRING; /* Store segment */ base->np_SegList = seglist; if((base->np_UtilityBase = OpenLibrary("utility.library", 0))) { KPRINTF(10, ("devInit: Ok\n")); KPRINTF(10, ("devInit: openCnt = %ld\n", base->np_Library.lib_OpenCnt)); return(base); } else { return(NULL); } return(base); AROS_USERFUNC_EXIT }
static int pgsql_load_dll(void) { if ((handle = OpenLibrary(PGSQL_LIB)) == NULL) return -1; if ( ((p_PQclear = (f_PQclear) GetFunction(handle, "PQclear")) == NULL) || ((p_PQcmdTuples = (f_PQcmdTuples) GetFunction(handle, "PQcmdTuples")) == NULL) || ((p_PQerrorMessage = (f_PQerrorMessage) GetFunction(handle, "PQerrorMessage")) == NULL) || ((p_PQescapeString = (f_PQescapeString) GetFunction(handle, "PQescapeString")) == NULL) || ((p_PQexec = (f_PQexec) GetFunction(handle, "PQexec")) == NULL) || ((p_PQfinish = (f_PQfinish) GetFunction(handle, "PQfinish")) == NULL) || ((p_PQfname = (f_PQfname) GetFunction(handle, "PQfname")) == NULL) || ((p_PQgetvalue = (f_PQgetvalue) GetFunction(handle, "PQgetvalue")) == NULL) || ((p_PQnfields = (f_PQnfields) GetFunction(handle, "PQnfields")) == NULL) || ((p_PQntuples = (f_PQntuples) GetFunction(handle, "PQntuples")) == NULL) || ((p_PQresultStatus = (f_PQresultStatus) GetFunction(handle, "PQresultStatus")) == NULL) || ((p_PQsetdbLogin = (f_PQsetdbLogin) GetFunction(handle, "PQsetdbLogin")) == NULL) || ((p_PQstatus = (f_PQstatus) GetFunction(handle, "PQstatus")) == NULL) ) { CloseLibrary(handle); handle = NULL; return -1; } return 0; }
BOOL amiga_init() { if(!SocketBase) SocketBase = OpenLibrary("bsdsocket.library", 4); if(!SocketBase) { __request("No TCP/IP Stack running!"); return FALSE; } if(SocketBaseTags( SBTM_SETVAL(SBTC_ERRNOPTR(sizeof(errno))), (ULONG) &errno, // SBTM_SETVAL(SBTC_HERRNOLONGPTR), (ULONG) &h_errno, SBTM_SETVAL(SBTC_LOGTAGPTR), (ULONG) "cURL", TAG_DONE)) { __request("SocketBaseTags ERROR"); return FALSE; } #ifndef __libnix__ atexit(amiga_cleanup); #endif return TRUE; }
/** * Initializes the network core (as that is needed for some platforms * @return true if the core has been initialized, false otherwise */ bool NetworkCoreInitialize() { #if defined(__MORPHOS__) || defined(__AMIGA__) /* * IMPORTANT NOTE: SocketBase needs to be initialized before we use _any_ * network related function, else: crash. */ DEBUG(net, 3, "[core] loading bsd socket library"); SocketBase = OpenLibrary("bsdsocket.library", 4); if (SocketBase == NULL) { DEBUG(net, 0, "[core] can't open bsdsocket.library version 4, network unavailable"); return false; } #if defined(__AMIGA__) /* for usleep() implementation (only required for legacy AmigaOS builds) */ TimerPort = CreateMsgPort(); if (TimerPort != NULL) { TimerRequest = (struct timerequest*)CreateIORequest(TimerPort, sizeof(struct timerequest); if (TimerRequest != NULL) { if (OpenDevice("timer.device", UNIT_MICROHZ, (struct IORequest*)TimerRequest, 0) == 0) { TimerBase = TimerRequest->tr_node.io_Device; if (TimerBase == NULL) { /* free resources... */ DEBUG(net, 0, "[core] can't initialize timer, network unavailable"); return false; } } } }
static int UUID_Init(LIBBASETYPEPTR LIBBASE) { struct timeval tv; uuid_time_t time_now; /* Set up global lock (class and interface locks are separate!) */ InitSemaphore(&LIBBASE->uuid_GlobalLock); D(bug("[UUID] UUID Init\n")); LIBBASE->uuid_Initialized = 0; /* I need timer.device in order to obtain system time */ if (OpenDevice("timer.device", UNIT_MICROHZ, &LIBBASE->uuid_TR, 0)) { D(bug("[UUID] Could not open timer.device. ABORT!\n")); return FALSE; } /* get the system time and convert it to UUID time */ GetSysTime(&tv); time_now = LIBBASE->uuid_NextUpdate = LIBBASE->uuid_LastTime = ((uint64_t)tv.tv_secs + 2922) * 10000000 + ((uint64_t)tv.tv_micro) * 10 + ((uint64_t)0x01B21DD213814000LL); D(bug("[UUID] UUID time: 0x%08lx%08lx\n", (uint32_t)((LIBBASE->uuid_LastTime >> 32) & 0xffffffff), (uint32_t)((LIBBASE->uuid_LastTime & 0xffffffff)) )); /* Seed the random generator */ time_now /= UUIDS_PER_TICK; UUIDBase->uuid_RandomSeed = (time_now >> 32) ^ time_now; UUIDBase->uuid_UUIDs_ThisTick = 0; /* Try to open dos.library for GetVar/SetVar */ DOSBase = OpenLibrary("dos.library", 0); if (DOSBase) { D(bug("[UUID] dos.library opened. Trying to get the UUID state.\n")); /* DOS is there. Try to get the last UUID state. */ if (GetVar("uuid_state", (UBYTE*)&LIBBASE->uuid_State, sizeof(uuid_state_t), GVF_BINARY_VAR | GVF_DONT_NULL_TERM) == sizeof(uuid_state_t)) { D(bug("[UUID] got last UUID state\n")); LIBBASE->uuid_Initialized = 1; } else { D(bug("[UUID] no UUID state found. Staying uninitlaized\n")); } } else D(bug("[UUID] dos.library not yet available. I will try later.")); return TRUE; }
static void OpenLibs(void) { if (!(IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library",39))) { Cleanup("Can't open intuition.library V39!"); } if (!(GfxBase = (struct GfxBase *)OpenLibrary("graphics.library",39))) { Cleanup("Can't open graphics.library V39!"); } if (!(LayersBase = OpenLibrary("layers.library",39))) { Cleanup("Can't open layers.library V39!"); } }
static void openlibs(void) { if (!(IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library", 39))) { cleanup("Can't open intuition.library V39!"); } if (!(GfxBase = (struct GfxBase *)OpenLibrary("graphics.library", 39))) { cleanup("Can't open graphics.library V39!"); } if (!(CyberGfxBase = OpenLibrary("cybergraphics.library",0))) { cleanup("Can't open cybergraphics.library!"); } }
/* Open and initialize AmiSSL */ static BOOL Init(void) { BOOL is_ok = FALSE; if (!(SocketBase = OpenLibrary("bsdsocket.library", 4))) FPrintf(GetStdErr(), "Couldn't open bsdsocket.library v4!\n"); #if defined(__amigaos4__) else if (!(ISocket = (struct SocketIFace *)GetInterface(SocketBase, "main", 1, NULL))) FPrintf(GetStdErr(), "Couldn't get Socket interface!\n"); #endif else if (!(AmiSSLMasterBase = OpenLibrary("amisslmaster.library", AMISSLMASTER_MIN_VERSION))) FPrintf(GetStdErr(), "Couldn't open amisslmaster.library v" MKSTR(AMISSLMASTER_MIN_VERSION) "!\n"); #if defined(__amigaos4__) else if (!(IAmiSSLMaster = (struct AmiSSLMasterIFace *)GetInterface(AmiSSLMasterBase, "main", 1, NULL))) FPrintf(GetStdErr(), "Couldn't get AmiSSLMaster interface!\n"); #endif else if (!InitAmiSSLMaster(AMISSL_CURRENT_VERSION, TRUE)) FPrintf(GetStdErr(), "AmiSSL version is too old!\n"); else if (!(AmiSSLBase = OpenAmiSSL())) FPrintf(GetStdErr(), "Couldn't open AmiSSL!\n"); #if defined(__amigaos4__) else if (!(IAmiSSL = (struct AmiSSLIFace *)GetInterface(AmiSSLBase, "main", 1, NULL))) FPrintf(GetStdErr(), "Couldn't get AmiSSL interface!\n"); #endif #if defined(__amigaos4__) else if (InitAmiSSL(AmiSSL_ErrNoPtr, &errno, AmiSSL_ISocket, ISocket, TAG_DONE) != 0) #else else if (InitAmiSSL(AmiSSL_ErrNoPtr, &errno, AmiSSL_SocketBase, SocketBase, TAG_DONE) != 0) #endif FPrintf(GetStdErr(), "Couldn't initialize AmiSSL!\n"); else is_ok = TRUE; if (!is_ok) Cleanup(); /* This is safe to call even if something failed above */ return(is_ok); }
void setup() { ExpatBase = OpenLibrary("expat.library", 4); IExpat = (struct ExpatIFace*)GetInterface(ExpatBase, "main", 1, NULL); if ( IExpat == 0 ) { DebugPrintF("Can't open expat.library\n"); } }
int main(void) { UtilityBase = (struct UtilityBase *)OpenLibrary("utility.library", 0); if (UtilityBase) { dt.dat_StrDate = "31-dec-2000"; dt.dat_Format = FORMAT_DOS; if (StrToDate(&dt)) { dt.dat_StrDate = s; if (DateToStr(&dt)) { printf("Verified date: \"%s\" days = %ld min = %ld tick = %ld\n", s, dt.dat_Stamp.ds_Days, dt.dat_Stamp.ds_Minute, dt.dat_Stamp.ds_Tick); Amiga2Date(dt.dat_Stamp.ds_Days * 60 * 60 * 24 + dt.dat_Stamp.ds_Minute * 60 + dt.dat_Stamp.ds_Tick / 50, &cd); printf("\nAmiga2Date says:\n\n"); printf("sec = %d\n", cd.sec); printf("min = %d\n", cd.min); printf("hour = %d\n", cd.hour); printf("mday = %d\n", cd.mday); printf("month = %d\n", cd.month); printf("year = %d\n", cd.year); printf("wday = %d\n", cd.wday); printf("\n-------- One day later -----------\n\n"); Amiga2Date((dt.dat_Stamp.ds_Days + 1) * 60 * 60 * 24 + dt.dat_Stamp.ds_Minute * 60 + dt.dat_Stamp.ds_Tick / 50, &cd); printf("\nAmiga2Date says:\n\n"); printf("sec = %d\n", cd.sec); printf("min = %d\n", cd.min); printf("hour = %d\n", cd.hour); printf("mday = %d\n", cd.mday); printf("month = %d\n", cd.month); printf("year = %d\n", cd.year); printf("wday = %d\n", cd.wday); } else puts("DateToStr failed!"); } else puts("StrToDate failed!"); CloseLibrary((struct Library *)UtilityBase); } return 0; }
TEXTURE_INFO *stub_texture_init(char *name, struct Library **Base) { *Base = OpenLibrary(name, 0); if(!Base) return NULL; TextureBase = *Base; return texture_init(); }
/* Initialize library */ static ASM(struct Library *) LibInit(REG(a0, SEGLISTPTR seglist), REG(d0, struct MCP9808BaseP * MCP9808Base), REG(a6, struct ExecBase *SysBase)) { #ifdef _M68060 if(!(SysBase->AttnFlags & AFF_68060)) return 0; #elif defined (_M68040) if(!(SysBase->AttnFlags & AFF_68040)) return 0; #elif defined (_M68030) if(!(SysBase->AttnFlags & AFF_68030)) return 0; #elif defined (_M68020) if(!(SysBase->AttnFlags & AFF_68020)) return 0; #endif /* Remember stuff */ MCP9808Base->i2cClass_SegList = seglist; MCP9808Base->i2cClass_SysBase = SysBase; #ifdef BASE_GLOBAL MakeGlobalSys(MCP9808Base); #endif if((MCP9808Base->i2cClass_IntuitionBase = (struct IntuitionBase *) OpenLibrary("intuition.library", 37))) { if((MCP9808Base->i2cClass_UtilityBase = (struct UtilityBase *) OpenLibrary("utility.library", 37))) { #ifdef BASE_GLOBAL MakeGlobalLibs(MCP9808Base); #endif return &MCP9808Base->i2cClass_LibNode; } CloseLibraries(MCP9808Base); } /* Free the vector table and the library data */ FreeMem((STRPTR) MCP9808Base - MCP9808Base->i2cClass_LibNode.lib_NegSize, MCP9808Base->i2cClass_LibNode.lib_NegSize + MCP9808Base->i2cClass_LibNode.lib_PosSize); return 0; }
int main (int argc, char ** argv) { struct Library *base1, *base2; BPTR seglist; FPuts(Output(), (STRPTR)"Testing peropener.library\n"); base1=OpenLibrary((STRPTR)"peropener.library",0); base2=OpenLibrary((STRPTR)"peropener.library",0); FPrintf(Output(), (STRPTR)"base1=%lx, base2=%lx\n", base1, base2); if (base1 != NULL) CloseLibrary(base1); if (base2 != NULL) CloseLibrary(base2); FPuts(Output(), (STRPTR)"\nTesting perid.library\n"); base1=OpenLibrary((STRPTR)"perid.library",0); base2=OpenLibrary((STRPTR)"perid.library",0); FPrintf(Output(), (STRPTR)"base1=%lx, base2=%lx\n", base1, base2); seglist = LoadSeg((CONST_STRPTR)"peropenertest_child"); if (seglist != (BPTR)NULL) { RunCommand(seglist, 10*1024, "\n", -1); UnLoadSeg(seglist); } else { FPrintf(Output(), (STRPTR)"Failed to load peropenertest_child\n"); } if (base1 != NULL) CloseLibrary(base1); if (base2 != NULL) CloseLibrary(base2); Flush (Output ()); return 0; }
/* ** main routine. Open required library and window and draw the images. ** This routine opens a very simple window with no IDCMP. See the ** chapters on "Windows" and "Input and Output Methods" for more info. ** Free all resources when done. */ int main(int argc, char *argv[]) { struct Window *win; struct Image myImage; IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library",37); if (IntuitionBase != NULL) { #ifdef __AROS__ if (NULL != (win = OpenWindowTags(NULL, WA_Width, 200, WA_Height, 100, WA_RMBTrap, TRUE, WA_IDCMP, IDCMP_RAWKEY, TAG_END))) #else if (NULL != (win = OpenWindowTags(NULL, WA_Width, 200, WA_Height, 100, WA_RMBTrap, TRUE, TAG_END))) #endif { myImage.LeftEdge = MYIMAGE_LEFT; myImage.TopEdge = MYIMAGE_TOP; myImage.Width = MYIMAGE_WIDTH; myImage.Height = MYIMAGE_HEIGHT; myImage.Depth = MYIMAGE_DEPTH; myImage.ImageData = myImageData; myImage.PlanePick = 0x1; /* use first bit-plane */ myImage.PlaneOnOff = 0x0; /* clear all unused planes */ myImage.NextImage = NULL; /* Draw the 1 bit-plane image into the first bit-plane (color 1) */ DrawImage(win->RPort,&myImage,10,10); /* Draw the same image at a new location */ DrawImage(win->RPort,&myImage,100,10); #ifdef __AROS__ /* Wait for a keypress */ Wait (1L << win->UserPort->mp_SigBit); #else /* Wait a bit, then quit. ** In a real application, this would be an event loop, like the ** one described in the Intuition Input and Output Methods chapter. */ Delay(200); #endif CloseWindow(win); } CloseLibrary((struct Library *)IntuitionBase); } return 0; }
int main( void ) { struct Library* EMU10kxBase; struct EMU10kxAC97* EMU10kxAC97; ULONG value; EMU10kxBase = OpenLibrary( "DEVS:AHI/emu10kx.audio", VERSION ); if( EMU10kxBase == NULL ) { Printf( "Unable to open DEVS:AHI/emu10kx.audio version %ld.\n", VERSION ); return RETURN_FAIL; } Forbid(); EMU10kxAC97 = (struct EMU10kxAC97*) FindSemaphore( EMU10KX_AC97_SEMAPHORE ); if( EMU10kxAC97 != NULL ) { ObtainSemaphore( &EMU10kxAC97->Semaphore ); } Permit(); if( EMU10kxAC97 == NULL ) { CloseLibrary( EMU10kxBase ); Printf( "Unable to find semaphore '%s'.\n", (ULONG) EMU10KX_AC97_SEMAPHORE ); return RETURN_FAIL; } Printf( "%ld EMU10kx cards found.\n", EMU10kxAC97->Cards ); value = CallHook( &EMU10kxAC97->GetFunc, (Object*) EMU10kxBase, 0, AC97_CD_VOL ); Printf( "CD volume on card 0 is 0x%04lx\n", value ); Printf( "Setting it to 0x0000.\n" ); CallHook( &EMU10kxAC97->SetFunc, (Object*) EMU10kxBase, 0, AC97_CD_VOL, 0 ); Delay( 3 * 50 ); Printf( "Restoring it.\n" ); CallHook( &EMU10kxAC97->SetFunc, (Object*) EMU10kxBase, 0, AC97_CD_VOL, value ); Printf( "Exiting.\n" ); if( EMU10kxAC97 != NULL ) { ReleaseSemaphore( &EMU10kxAC97->Semaphore ); } CloseLibrary( EMU10kxBase ); return RETURN_OK; }
static SOCKET server_connect(const char *host, unsigned short nport) { struct hostent *he; char **ap; #ifdef WIN32 static int need_init = 1; if (need_init) { WSADATA wsa; if (WSAStartup(MAKEWORD(2, 0), &wsa)) return INVALID_SOCKET; need_init = 0; } #elif defined(USE_AMITCP) if (!socket_base) { socket_base = OpenLibrary("bsdsocket.library", 4); if (!socket_base) return INVALID_SOCKET; } #endif he = gethostbyname(host); if (!he) return INVALID_SOCKET; for (ap = he->h_addr_list; *ap; ++ap) { SOCKET sock; struct sockaddr_in sa; sa.sin_family = he->h_addrtype; sa.sin_port = htons(nport); memcpy(&sa.sin_addr, *ap, he->h_length); memset(&sa.sin_zero, 0, sizeof(sa.sin_zero)); sock = socket(he->h_addrtype, SOCK_STREAM, 0); if (sock == INVALID_SOCKET) continue; if (connect(sock, (struct sockaddr *)&sa, sizeof(sa)) >= 0) { char greet[128]; if (xsend(sock, CLIENT_GREET, strlen(CLIENT_GREET), 0) || xrecv(sock, greet, strlen(SERVER_GREET), 0)) { closesocket(sock); continue; } if (!strncmp(SERVER_GREET, greet, strlen(SERVER_GREET))) return sock; } closesocket(sock); } return INVALID_SOCKET; }
void main(int argc,char **argv) { if (DOpusBase=OpenLibrary("dopus5.library",0)) { if (argv[1] && *argv[1]) ShowDebug(argv[1]); CloseLibrary(DOpusBase); } exit(0); }
BOOL PreClassInitFunc(void) { if((LocaleBase = OpenLibrary("locale.library", 37L)) && GETINTERFACE(ILocale, LocaleBase)) { return TRUE; } return FALSE; }
struct DriverBase* _LibInit( struct DriverBase* AHIsubBase, BPTR seglist, struct ExecBase* sysbase ) { SysBase = sysbase; AHIsubBase->library.lib_Node.ln_Type = NT_LIBRARY; AHIsubBase->library.lib_Node.ln_Name = (STRPTR) LibName; AHIsubBase->library.lib_Flags = LIBF_SUMUSED | LIBF_CHANGED; AHIsubBase->library.lib_Version = VERSION; AHIsubBase->library.lib_Revision = REVISION; AHIsubBase->library.lib_IdString = (STRPTR) LibIDString; AHIsubBase->seglist = seglist; AHIsubBase->intuitionbase = OpenLibrary( INTUITIONNAME, 37 ); AHIsubBase->utilitybase = OpenLibrary( UTILITYNAME, 37 ); if( IntuitionBase == NULL ) { Alert( AN_Unknown|AG_OpenLib|AO_Intuition ); goto error; } if( UtilityBase == NULL ) { Req( "Unable to open 'utility.library' version 37.\n" ); goto error; } if( ! DriverInit( AHIsubBase ) ) { goto error; } return AHIsubBase; error: _LibExpunge( AHIsubBase ); return NULL; }
int main(int argc, char *argv[]) { if (DataTypesBase=OpenLibrary("datatypes.library",0)) { if (dto=NewDTObject(argv[1],TAG_DONE)) { DoQuery(argv[1]); DisposeDTObject(dto); } CloseLibrary(DataTypesBase); } return 0; }
int checkusergrouplib(void) { if(!UserGroupBase) { if(!(UserGroupBase=OpenLibrary("usergroup.library",4))) { PyErr_SetString(PyExc_SystemError, "Couldn't open usergroup.library"); return 0; } } return 1; }
int main(void) { Object *wnd; MUIMasterBase = (struct Library*)OpenLibrary("muimaster.library",0); app = ApplicationObject, SubWindow, wnd = WindowObject, MUIA_Window_Title, "crawling", MUIA_Window_Activate, TRUE, WindowContents, VGroup, Child, CrawlingObject, TextFrame, MUIA_Background, MUII_TextBack, MUIA_FixHeightTxt, "\n", Child, TextObject, MUIA_Text_Contents, "One\nTwo\nThree\nFour\nFive\nSix\nSeven\nEight\nNine\nTen\nOne\nTwo", End, End, End, End, End; if (app) { ULONG sigs = 0; DoMethod ( wnd, MUIM_Notify, MUIA_Window_CloseRequest, TRUE, (IPTR) app, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit ); set(wnd,MUIA_Window_Open,TRUE); while (DoMethod(app, MUIM_Application_NewInput, (IPTR) &sigs) != MUIV_Application_ReturnID_Quit) { if (sigs) { sigs = Wait(sigs | SIGBREAKF_CTRL_C | SIGBREAKF_CTRL_D); if (sigs & SIGBREAKF_CTRL_C) break; if (sigs & SIGBREAKF_CTRL_D) break; } } MUI_DisposeObject(app); } CloseLibrary(MUIMasterBase); return 0; }
// Open dopus5.library void startup_open_dopuslib() { // Open the library #ifdef __amigaos4__ if (!OpenLibIFace("dopus5:libs/dopus5.library", (APTR)&DOpusBase, (APTR)&IDOpus, LIB_VERSION)) #else if (!(DOpusBase=OpenLibrary("dopus5:libs/dopus5.library",LIB_VERSION))) #endif { #ifndef __amigaos3__ struct Library *IntuitionBase; //Crashes OS3 binary #endif // Get Intuition #ifdef __amigaos4__ if (OpenLibIFace("intuition.library", (APTR)&IntuitionBase, (APTR)&IIntuition, 0)) #else if ((IntuitionBase=(struct IntuitionBase *)OpenLibrary("intuition.library",0))) #endif { struct EasyStruct easy; // Fill out EasyStruct easy.es_StructSize=sizeof(easy); easy.es_Flags=0; easy.es_Title=dopus_name; easy.es_TextFormat="Unable to open dopus5.library!"; easy.es_GadgetFormat="Ok"; // Show error EasyRequestArgs(0,&easy,0,0); // Close library #ifdef __amigaos4__ DropInterface((struct Interface *)IIntuition); #endif CloseLibrary((struct Library *)IntuitionBase); } exit(0); } }