aboutsummaryrefslogtreecommitdiff
path: root/gcc/m2/gm2-libs/RTint.mod
diff options
context:
space:
mode:
authorGaius Mulley <gaiusmod2@gmail.com>2023-02-25 16:28:19 +0000
committerGaius Mulley <gaiusmod2@gmail.com>2023-02-25 16:28:19 +0000
commit05652ac4e8b8685fe0c0f4ee2f75516d28bbf892 (patch)
tree37d3bf0f0a89774a4733b706ddaf3cff5447b182 /gcc/m2/gm2-libs/RTint.mod
parent461d3c84a0e5ad045ee54631901cc953d6befa20 (diff)
downloadgcc-05652ac4e8b8685fe0c0f4ee2f75516d28bbf892.zip
gcc-05652ac4e8b8685fe0c0f4ee2f75516d28bbf892.tar.gz
gcc-05652ac4e8b8685fe0c0f4ee2f75516d28bbf892.tar.bz2
modula-2 module registration process seems to fail with shared libraries [PR108261]
The commit adds pathnames to modula-2 which in turn appears in any external symbol. This is necessary to allow different dialects of libraries to coexist (different implementations of SYSTEM and Storage for example in libm2pim and libm2iso). It also makes it easier to debug as the library name forms part of the external mangled name. By default pathnames are not user facing. This commit fixes PR108261. gcc/ChangeLog: PR modula2/108261 * doc/gm2.texi (-fm2-pathname): New option documented. (-fm2-pathnameI): New option documented. (-fm2-prefix=): New option documented. (-fruntime-modules=): Update default module list. gcc/m2/ChangeLog: PR modula2/108261 * Make-lang.in (GM2-COMP-BOOT-DEFS): DynamicStringPath.def remove. DynamicPath.def add. (GM2-COMP-BOOT-MODS): DynamicStringPath.mod remove. DynamicPath.mod add. * Make-maintainer.in (BUILD-BOOT-PPG-H): New dependency. (m2/gm2-ppg-boot/$(SRC_PREFIX)%.o): $(BUILD-BOOT-PPG-H) Add dependency. (PGE-DEF): New definition. (BUILD-BOOT-PG-H): New dependency. (m2/gm2-pg-boot/$(SRC_PREFIX)%.o): $(BUILD-BOOT-PG-H) Add dependency. (BUILD-BOOT-PGE-H): New dependency. (m2/gm2-pge-boot/$(SRC_PREFIX)%.o): $(BUILD-BOOT-PGE-H) Add dependency. (GM2PATH): Add pathname entries. (m2/boot-bin/mc-devel$(exeext)): Add m2/mc-boot-ch/Gm2rtsdummy.o dependency. (m2/boot-bin/mc-opt$(exeext)): Fix -I path. * gm2-compiler/DynamicStringPath.def: Renamed module to DynamicPath. (GetUserPath): Remove. (GetSystemPath): Remove. (SetUserPath): Remove. (SetSystemPath): Remove. (DumpPath): New procedure definition. * gm2-compiler/DynamicStringPath.mod: Renamed module to DynamicPath. (GetUserPath): Remove. (GetSystemPath): Remove. (SetUserPath): Remove. (SetSystemPath): Remove. (DumpPath): Remove Debugging conditional. * gm2-compiler/M2AsmUtil.mod: Import EqualArray, NulName and GetLibName. (Debugging): New declaration. (GetFullSymName): Re-implemented to prefix (mange) libname to any extern variable/procedure which is IsExportQualified. * gm2-compiler/M2Comp.mod (qprintLibName): New procedure. * gm2-compiler/M2Graph.mod (resolveImports): Add libname. * gm2-compiler/M2Options.def (SetM2Prefix): New procedure. (GetM2Prefix): New procedure function. (SetM2PathName): New procedure. (GetM2PathName): New procedure function. * gm2-compiler/M2Options.mod: (SetM2Prefix): New procedure implemented. (GetM2Prefix): New procedure function implemented. (SetM2PathName): New procedure implemented. (GetM2PathName): New procedure function implemented. (RuntimeModuleOverride): Set to DefaultRuntimeModuleOverride. * gm2-compiler/M2Quads.mod: Import GetLibName. (SafeRequestSym) Pass result of GetLibName to RequestDependant. (callRequestDependant): Add libname as a parameter. (BuildM2InitFunction): Add libname as a parameter. (BuildM2FiniFunction): Add libname as a parameter. (BuildM2CtorFunction): Add libname as a parameter. * gm2-compiler/M2Scaffold.mod (LookupModuleSym): Set LibName if a definition source was found. * gm2-compiler/M2Search.def (FindSourceFile): Add named library parameter. (FindSourceDefFile): Add named library parameter. (FindSourceModFile): Add named library parameter. * gm2-compiler/M2Search.mod (FindSourceFile): Reimplement. (FindSourceDefFile): Add named library parameter. (FindSourceModFile): Add named library parameter. * gm2-compiler/SymbolTable.def (MakeProcedureCtorExtern): Add libname parameter. (PutLibName): New procedure. (GetLibName): New procedure function. * gm2-compiler/SymbolTable.mod (MakeProcedureCtorExtern): Add libname parameter. (GenName): Add libname parameter. (InitCtorFields): Add moduleSym as a parameter. (PutCtorExtern): Add libname parameter to GenName. * gm2-gcc/init.cc (_M2_DynamicStringPath_init): Rename function... (_M2_DynamicPath_init): ...to this. (_M2_PathName_init): Added. * gm2-gcc/m2decl.cc (m2decl_DeclareM2linkStaticInitialization): Add m2pim as the manged component of the exported symbol. (m2decl_DeclareM2linkForcedModuleInitOrder): Add m2pim mangle prefix. * gm2-gcc/m2options.h (M2Options_SetM2Prefix): New function. (M2Options_GetM2Prefix): New function. (M2Options_SetM2PathName): New function. (M2Options_GetM2PathName): New function. * gm2-lang.cc (push_back_Ipath): New function. (add_one_import_path): New function. (gm2_langhook_handle_option): Record -I component. Call SetM2PathName when -fm2-pathname= is seen. Record -fm2-pathnameI component. Call SetM2Prefix when -fm2-prefix= is seen. (gm2_langhook_post_options): Iterative over pathname entries and call SetM2PathName, SetSearchPath as appropriate. * gm2-libs-iso/M2RTS.def (ConstructModules): Add libname parameter. (DeconstructModules): Add libname parameter. (RegisterModule): Add libname parameter. (RequestDependant): Add libname parameter. * gm2-libs-iso/M2RTS.mod (ConstructModules): Add libname parameter. (DeconstructModules): Add libname parameter. (RegisterModule): Add libname parameter. (RequestDependant): Add libname parameter. * gm2-libs-min/M2RTS.def (ConstructModules): Add libname parameter. (DeconstructModules): Add libname parameter. (RegisterModule): Add libname parameter. (RequestDependant): Add libname parameter. * gm2-libs-min/M2RTS.mod (ConstructModules): Add libname parameter. (DeconstructModules): Add libname parameter. (RegisterModule): Add libname parameter. (RequestDependant): Add libname parameter. * gm2-libs/M2Dependent.def (ConstructModules): Add libname parameter. (DeconstructModules): Add libname parameter. (RegisterModule): Add libname parameter. (RequestDependant): Add libname parameter. * gm2-libs/M2Dependent.mod (ConstructModules): Add libname parameter. (DeconstructModules): Add libname parameter. (RegisterModule): Add libname parameter. (RequestDependant): Add libname parameter. * gm2-libs/M2RTS.def (ConstructModules): Add libname parameter. (DeconstructModules): Add libname parameter. (RegisterModule): Add libname parameter. (RequestDependant): Add libname parameter. * gm2-libs/M2RTS.mod (ConstructModules): Add libname parameter. (DeconstructModules): Add libname parameter. (RegisterModule): Add libname parameter. (RequestDependant): Add libname parameter. * gm2-libs/RTint.mod (FindVector): Rename variables. (initInputVector): Rename variables. (initOutputVector): Rename variables. (InitTimeVector): Rename variables. (FindVectorNo): Rename variables. (FindPendingVector): Rename variables. (ReArmTimeVector): Rename variables. (GetTimeVector): Rename variables. (AttachVector): Rename variables. (AttachVector): Rename variables. (IncludeVector): Rename variables. (ExcludeVector): Rename variables. (AddFd): Rename variables. (AddFd): Rename variables. (DumpPendingQueue): Rename variables. (stop): Remove. (activatePending): Rename variables. (Listen): Rename variables. * gm2-libs/libc.def (snprintf): New function. * gm2-libs/sckt.def: Change all exported identifiers to be export qualified. * gm2spec.cc (push_back_Ipath): New function. (add_m2_I_path): New function. (lang_specific_driver): Skip -fm2-pathname= and remember pathname. Skip -I and record the path and current pathname. Call add_m2_I_path. * lang-specs.h: Replace %{I*} with %{fm2-pathname*}. * lang.opt (-fm2-pathname=): New entry. (-fm2-pathname): New entry. (-fm2-prefix=): New entry. * mc-boot-ch/GUnixArgs.cc (_M2_UnixArgs_dep): New function. (_M2_UnixArgs_ctor::_M2_UnixArgs_ctor): New method. * mc-boot-ch/Glibc.c (libc_snprintf): New function. * mc-boot-ch/m2rts.h (M2RTS_RequestDependant): Changed prototype. (M2RTS_RegisterModule): Changed prototype. * mc-boot/GDynamicStrings.c: Rebuild. * mc-boot/GFIO.c: Rebuild. * mc-boot/GIndexing.c: Rebuild. * mc-boot/GM2Dependent.c: Rebuild. * mc-boot/GM2Dependent.h: Rebuild. * mc-boot/GM2EXCEPTION.c: Rebuild. * mc-boot/GM2RTS.c: Rebuild. * mc-boot/GM2RTS.h: Rebuild. * mc-boot/GPushBackInput.c: Rebuild. * mc-boot/GRTExceptions.c: Rebuild. * mc-boot/GRTint.c: Rebuild. * mc-boot/GStdIO.c: Rebuild. * mc-boot/GStringConvert.c: Rebuild. * mc-boot/GSysStorage.c: Rebuild. * mc-boot/Gdecl.c: Rebuild. * mc-boot/Gkeyc.c: Rebuild. * mc-boot/Glibc.h: Rebuild. * mc-boot/GmcComment.c: Rebuild. * mc-boot/GmcComp.c: Rebuild. * mc-boot/GmcDebug.c: Rebuild. * mc-boot/GmcMetaError.c: Rebuild. * mc-boot/GmcStack.c: Rebuild. * mc-boot/GnameKey.c: Rebuild. * mc-boot/GsymbolKey.c: Rebuild. * pge-boot/GASCII.c: Rebuild. * pge-boot/GArgs.c: Rebuild. * pge-boot/GAssertion.c: Rebuild. * pge-boot/GDebug.c: Rebuild. * pge-boot/GDynamicStrings.c: Rebuild. * pge-boot/GFIO.c: Rebuild. * pge-boot/GIO.c: Rebuild. * pge-boot/GIndexing.c: Rebuild. * pge-boot/GLists.c: Rebuild. * pge-boot/GM2Dependent.c: Rebuild. * pge-boot/GM2Dependent.h: Rebuild. * pge-boot/GM2EXCEPTION.c: Rebuild. * pge-boot/GM2RTS.c: Rebuild. * pge-boot/GM2RTS.h: Rebuild. * pge-boot/GNameKey.c: Rebuild. * pge-boot/GNumberIO.c: Rebuild. * pge-boot/GOutput.c: Rebuild. * pge-boot/GPushBackInput.c: Rebuild. * pge-boot/GRTExceptions.c: Rebuild. * pge-boot/GSFIO.c: Rebuild. * pge-boot/GStdIO.c: Rebuild. * pge-boot/GStorage.c: Rebuild. * pge-boot/GStrCase.c: Rebuild. * pge-boot/GStrIO.c: Rebuild. * pge-boot/GStrLib.c: Rebuild. * pge-boot/GSymbolKey.c: Rebuild. * pge-boot/GSysExceptions.c (_M2_SysExceptions_finish): Rename this... (_M2_SysExceptions_fini): ... to this. * pge-boot/GSysStorage.c: Rebuild. (_M2_SysStorage_finish): Rename this... (_M2_SysStorage_fini): ... to this. * pge-boot/GUnixArgs.cc: New file. * pge-boot/Gbnflex.c (_M2_bnflex_finish): Rename this... (_M2_bnflex_fini): ... to this. * pge-boot/Gerrno.c (_M2_errno_finish): Rename this... (_M2_errno_fini): ... to this. * pge-boot/Glibc.c (libc_snprintf): New function. * pge-boot/Glibc.h (libc_snprintf): New prototype. * pge-boot/Gpge.c (_M2_pge_finish): Rename this... (_M2_pge_fini): ... to this. * pge-boot/Gtermios.cc (_M2_termios_finish): Rename this... (_M2_termios_fini): ... to this. * pge-boot/main.c (_M2_RTExceptions_finish): Rename this... (_M2_RTExceptions_fini): ... to this. (_M2_M2EXCEPTION_finish): Rename this... (_M2_M2EXCEPTION_fini): ... to this. (_M2_M2RTS_finish): Rename this... (_M2_M2RTS_fini): ... to this. (_M2_SysExceptions_finish): Rename this... (_M2_SysExceptions_fini): ... to this. (_M2_StrLib_finish): Rename this... (_M2_StrLib_fini): ... to this. (_M2_errno_finish): Rename this... (_M2_errno_fini): ... to this. (_M2_termios_finish): Rename this... (_M2_termios_fini): ... to this. (_M2_IO_finish): Rename this... (_M2_IO_fini): ... to this. (_M2_StdIO_finish): Rename this... (_M2_StdIO_fini): ... to this. (_M2_Debug_finish): Rename this... (_M2_Debug_fini): ... to this. (_M2_SysStorage_finish): Rename this... (_M2_SysStorage_fini): ... to this. (_M2_Storage_finish): Rename this... (_M2_Storage_fini): ... to this. (_M2_StrIO_finish): Rename this... (_M2_StrIO_fini): ... to this. (_M2_DynamicStrings_finish): Rename this... (_M2_DynamicStrings_fini): ... to this. (_M2_Assertion_finish): Rename this... (_M2_Assertion_fini): ... to this. (_M2_Indexing_finish): Rename this... (_M2_Indexing_fini): ... to this. (_M2_NameKey_finish): Rename this... (_M2_NameKey_fini): ... to this. (_M2_NumberIO_finish): Rename this... (_M2_NumberIO_fini): ... to this. (_M2_PushBackInput_finish): Rename this... (_M2_PushBackInput_fini): ... to this. (_M2_SymbolKey_finish): Rename this... (_M2_SymbolKey_fini): ... to this. (_M2_UnixArgs_finish): Rename this... (_M2_UnixArgs_fini): ... to this. (_M2_FIO_finish): Rename this... (_M2_FIO_fini): ... to this. (_M2_SFIO_finish): Rename this... (_M2_SFIO_fini): ... to this. (_M2_StrCase_finish): Rename this... (_M2_StrCase_fini): ... to this. (_M2_bnflex_finish): Rename this... (_M2_bnflex_fini): ... to this. (_M2_Lists_finish): Rename this... (_M2_Lists_fini): ... to this. (_M2_Args_finish): Rename this... (_M2_Args_fini): ... to this. (_M2_Output_finish): Rename this... (_M2_Output_fini): ... to this. (_M2_pge_finish): Rename this... (_M2_pge_fini): ... to this. * plugin/m2rte.cc (m2_runtime_error_calls): Change all runtime procedure names to their name mangled counterparts. * gm2-libs-iso/wrapsock.c: Removed. * gm2-libs-iso/wraptime.c: Removed. * mc-boot/Gpth.h: Removed. * gm2-compiler/PathName.def: New file. * gm2-compiler/PathName.mod: New file. libgm2/ChangeLog: PR modula2/108261 * libm2cor/KeyBoardLEDs.cc (EXPORT): New define. (M2EXPORT): New define. (M2LIBNAME): New define. (KeyBoardLEDs_SwitchScroll): EXPORT. (KeyBoardLEDs_SwitchNum): EXPORT. (KeyBoardLEDs_SwitchCaps): EXPORT. (KeyBoardLEDs_SwitchLeds): EXPORT. (_M2_KeyBoardLEDs_init): M2EXPORT. (_M2_KeyBoardLEDs_finish): M2EXPORT. (_M2_KeyBoardLEDs_dep): M2EXPORT. * libm2cor/Makefile.am (libm2cor_la_M2FLAGS): Define path names. * libm2cor/Makefile.in: Rebuild. * libm2iso/ErrnoCategory.cc (EXPORT): New define. (M2EXPORT): New define. (M2LIBNAME): New define. (ErrnoCategory_IsErrnoHard): EXPORT. (ErrnoCategory_IsErrnoSoft): EXPORT. (ErrnoCategory_UnAvailable): EXPORT. (ErrnoCategory_GetOpenResults): EXPORT. (_M2_ErrnoCategory_init): M2EXPORT. (_M2_ErrnoCategory_fini): M2EXPORT. (_M2_ErrnoCategory_dep): M2EXPORT. (_M2_ErrnoCategory_ctor): M2EXPORT. * libm2iso/Makefile.am (libm2iso_la_M2FLAGS): Define path names. * libm2iso/Makefile.in: Rebuild. * libm2iso/RTco.cc (EXPORT): New define. (M2EXPORT): New define. (M2LIBNAME): New define. (newSem): Add module libname prefix to HaltC. (currentThread): Remove variable and replace with a function. (never): Add module libname prefix to HaltC. (initThread): Add module libname prefix to HaltC. * libm2iso/m2rts.h (str): New define. (M2RTS_RequestDependant): Change to the mangled name equivalent. (M2RTS_RegisterModule): Change to the mangled name equivalent. (m2iso_M2RTS_RequestDependant): Add libname parameter. (m2iso_M2RTS_RegisterModule): Add libname parameter. (m2pim_M2RTS_RegisterModule): Add libname parameter. (_M2_M2RTS_init): Rename this... (m2iso_M2_M2RTS_init): ...to this. (M2RTS_ConstructModules): Change to the mangled name equivalent. (M2RTS_Terminate): Change to the mangled name equivalent. (M2RTS_DeconstructModules): Change to the mangled name equivalent. (m2iso_M2RTS_ConstructModules): Add libname parameter. (m2iso_M2RTS_Terminate): Add libname parameter. (m2iso_M2RTS_DeconstructModules): Add libname parameter. (M2RTS_HaltC): Rename this... (m2iso_M2RTS_HaltC): ...to this. * libm2iso/wrapsock.c (EXPORT): New define. (IMPORT): New define. (M2EXPORT): New define. (M2LIBNAME): New define. (m2iso_M2RTS_RequestDependant): Add prototype. (wrapsock_clientOpen): EXPORT. (wrapsock_clientOpenIP): EXPORT. (wrapsock_getClientPortNo): EXPORT. (wrapsock_getClientHostname): EXPORT. (wrapsock_getClientSocketFd): EXPORT. (wrapsock_getClientIP): EXPORT. (wrapsock_getPushBackChar): EXPORT. (wrapsock_setPushBackChar): EXPORT. (wrapsock_getSizeOfClientInfo): EXPORT. (_M2_wrapsock_init): M2EXPORT. (_M2_wrapsock_fini): M2EXPORT. (ctor): M2EXPORT. New function. * libm2iso/wraptime.c: Rename to... * libm2iso/wraptime.cc: ...this. (EXPORT): New define. (M2EXPORT): New define. (M2LIBNAME): New define. (wraptime_InitTimeval): EXPORT. (wraptime_KillTimeval): EXPORT. (wraptime_InitTimezone): EXPORT. (wraptime_KillTimezone): EXPORT. (wraptime_InitTM): EXPORT. (wraptime_KillTM): EXPORT. (wraptime_gettimeofday): EXPORT. (wraptime_settimeofday): EXPORT. (wraptime_GetFractions): EXPORT. (wraptime_localtime_r): EXPORT. (wraptime_GetYear): EXPORT. (wraptime_GetMonth): EXPORT. (wraptime_GetDay): EXPORT. (wraptime_GetHour): EXPORT. (wraptime_GetMinute): EXPORT. (wraptime_GetSecond): EXPORT. (wraptime_GetSummerTime): EXPORT. (wraptime_GetDST): EXPORT. (wraptime_SetTimezone): EXPORT. (wraptime_SetTimeval): EXPORT. (_M2_wraptime_init): M2EXPORT. (_M2_wraptime_fini): M2EXPORT. (ctor): M2EXPORT. New function. * libm2log/Makefile.am (libm2log_la_M2FLAGS): Define path names. * libm2log/Makefile.in: * libm2min/Makefile.am (libm2min_la_M2FLAGS): Define path names. * libm2min/Makefile.in: * libm2pim/Makefile.am (libm2pim_la_M2FLAGS): Define path names. * libm2pim/Makefile.in: * libm2pim/Selective.cc (EXPORT): New define. (M2EXPORT): New define. (M2LIBNAME): New define. (Selective_Select): EXPORT. (Selective_InitTime): EXPORT. (Selective_GetTime): EXPORT. (Selective_SetTime): EXPORT. (Selective_KillTime): EXPORT. (Selective_InitSet): EXPORT. (Selective_KillSet): EXPORT. (Selective_FdZero): EXPORT. (Selective_FdSet): EXPORT. (Selective_FdClr): EXPORT. (Selective_FdIsSet): EXPORT. (Selective_GetTimeOfDay): EXPORT. (Selective_MaxFdsPlusOne): EXPORT. (Selective_WriteCharRaw): EXPORT. (Selective_ReadCharRaw): EXPORT. (_M2_Selective_init): M2EXPORT. (_M2_Selective_fini): M2EXPORT. (_M2_Selective_dep): M2EXPORT. (_M2_Selective_ctor): M2EXPORT. * libm2pim/SysExceptions.cc (EXPORT): New define. (M2EXPORT): New define. (M2LIBNAME): New define. (SysExceptions_InitExceptionHandlers): EXPORT. (_M2_SysExceptions_init): M2EXPORT. (_M2_SysExceptions_fini): M2EXPORT. (_M2_SysExceptions_dep): M2EXPORT. (_M2_SysExceptions_ctor): M2EXPORT. * libm2pim/UnixArgs.cc (EXPORT): New define. (M2EXPORT): New define. (M2LIBNAME): New define. (UnixArgs_GetArgC): EXPORT. (UnixArgs_GetArgV): EXPORT. (UnixArgs_GetEnvV): EXPORT. (_M2_UnixArgs_init): M2EXPORT. (_M2_UnixArgs_fini): M2EXPORT. (_M2_UnixArgs_dep): M2EXPORT. (_M2_UnixArgs_ctor): M2EXPORT. * libm2pim/cgetopt.cc (EXPORT): New define. (M2EXPORT): New define. (M2LIBNAME): New define. (cgetopt_getopt): EXPORT. (cgetopt_getopt_long): EXPORT. (cgetopt_getopt_long_only): EXPORT. (cgetopt_InitOptions): EXPORT. (cgetopt_KillOptions): EXPORT. (cgetopt_SetOption): EXPORT. (cgetopt_GetLongOptionArray): EXPORT. (_M2_cgetopt_init): M2EXPORT. (_M2_cgetopt_fini): M2EXPORT. (_M2_cgetopt_dep): M2EXPORT. (_M2_cgetopt_ctor): M2EXPORT. * libm2pim/dtoa.cc (EXPORT): New define. (M2EXPORT): New define. (M2LIBNAME): New define. (dtoa_strtod): EXPORT. (dtoa_calcmaxsig): EXPORT. (dtoa_calcdecimal): EXPORT. (dtoa_calcsign): EXPORT. (dtoa_dtoa): EXPORT. (_M2_dtoa_init): M2EXPORT. (_M2_dtoa_fini): M2EXPORT. (_M2_dtoa_dep): M2EXPORT. (_M2_dtoa_ctor): M2EXPORT. * libm2pim/errno.cc (EXPORT): New define. (M2EXPORT): New define. (M2LIBNAME): New define. (errno_geterrno): EXPORT. (_M2_errno_init): M2EXPORT. (_M2_errno_fini): M2EXPORT. (_M2_errno_dep): M2EXPORT. (_M2_errno_ctor): M2EXPORT. * libm2pim/ldtoa.cc (EXPORT): New define. (IMPORT): New define. (M2EXPORT): New define. (M2LIBNAME): New define. (dtoa_calcmaxsig): EXPORT. (dtoa_calcdecimal): EXPORT. (dtoa_calcsign): EXPORT. (ldtoa_strtold): EXPORT. (ldtoa_ldtoa): EXPORT. (_M2_ldtoa_init): M2EXPORT. (_M2_ldtoa_fini): M2EXPORT. (_M2_ldtoa_dep): M2EXPORT. (_M2_ldtoa_ctor): M2EXPORT. * libm2pim/sckt.cc (EXPORT): New define. (M2EXPORT): New define. (M2LIBNAME): New define. (tcpServerEstablishPort): EXPORT. (tcpServerEstablish): EXPORT. (tcpServerAccept): EXPORT. (tcpServerPortNo): EXPORT. (tcpServerSocketFd): EXPORT. (getLocalIP): EXPORT. (tcpServerIP): EXPORT. (tcpServerClientIP): EXPORT. (tcpServerClientPortNo): EXPORT. (tcpClientSocket): EXPORT. (tcpClientSocketIP): EXPORT. (tcpClientConnect): EXPORT. (tcpClientPortNo): EXPORT. (tcpClientSocketFd): EXPORT. (tcpClientIP): EXPORT. (_M2_sckt_init): M2EXPORT. (_M2_sckt_finish): M2EXPORT. (_M2_sckt_dep): M2EXPORT. (_M2_sckt_ctor): M2EXPORT. * libm2pim/termios.cc (EXPORT): New define. (M2EXPORT): New define. (M2LIBNAME): New define. (_M2_termios_init): M2EXPORT. (_M2_termios_fini): M2EXPORT. (_M2_termios_dep): M2EXPORT. (_M2_termios_ctor): M2EXPORT. * libm2pim/wrapc.c (EXPORT): New define. (M2EXPORT): New define. (M2LIBNAME): New define. (wrapc_strtime): EXPORT. (wrapc_filesize): EXPORT. (wrapc_filemtime): EXPORT. (wrapc_fileinode): EXPORT. (wrapc_getrand): EXPORT. (wrapc_getusername): EXPORT. (wrapc_getnameuidgid): EXPORT. (wrapc_signbit): EXPORT. (wrapc_signbitl): EXPORT. (wrapc_signbitf): EXPORT. (wrapc_isfinite): EXPORT. (wrapc_isfinitel): EXPORT. (wrapc_isfinitef): EXPORT. (_M2_wrapc_init): M2EXPORT. (_M2_wrapc_fini): M2EXPORT. (_M2_wrapc_ctor): M2EXPORT. gcc/testsuite/ChangeLog: PR modula2/108261 * gm2/examples/callingC/pass/examples-callingC-pass.exp: Tidy up variable access. * gm2/examples/callingC/run/pass/examples-callingC-run-pass.exp: Tidy up variable access. * gm2/examples/cpp/pass/examples-cpp-pass.exp: Tidy up variable access. * gm2/examples/cppDef/pass/examples-cppDef-pass.exp: Tidy up variable access. * gm2/examples/hello/pass/examples-hello-pass.exp: Tidy up variable access. * gm2/examples/map/pass/examples-map-pass.exp: Tidy up variable access. * gm2/iso/check/fail/iso-check-fail.exp: Add pathname. * gm2/link/externalscaffold/pass/link-externalscaffold-pass.exp: Add pathname. * gm2/link/externalscaffold/pass/scaffold.c: Add mangled export name. * gm2/pimlib/base/run/pass/FIO.mod: Updated test code. * gm2/pimlib/base/run/pass/StrLib.mod: Updated test code. * gm2/pimlib/base/run/pass/pimlib-base-run-pass.exp: Remove path. * gm2/projects/pim/run/pass/random/projects-pim-run-pass-random.exp: Tidy up variable access. * gm2/switches/auto-init/fail/switches-auto-init-fail.exp: Add pathname. * gm2/switches/check-all/pim2/fail/switches-check-all-pim2-fail.exp: Add pathname. * gm2/switches/makeall/fail/switches-makeall-fail.exp: Remove -fmakeall. * gm2/switches/makeall/pass/switches-makeall-pass.exp: Remove -fmakeall. * lib/gm2-simple.exp (gm2_keep_executable): New global variable. (gm2_simple_execute): Keep executable if global is true. * lib/gm2-torture.exp: Add ; after global variable access. * lib/gm2.exp: Set up pathnames. * gm2/projects/pim/run/pass/tower/AdvCmd.def: New test. * gm2/projects/pim/run/pass/tower/AdvCmd.mod: New test. * gm2/projects/pim/run/pass/tower/AdvIntroduction.def: New test. * gm2/projects/pim/run/pass/tower/AdvIntroduction.mod: New test. * gm2/projects/pim/run/pass/tower/AdvMap.def: New test. * gm2/projects/pim/run/pass/tower/AdvMap.mod: New test. * gm2/projects/pim/run/pass/tower/AdvMath.def: New test. * gm2/projects/pim/run/pass/tower/AdvMath.mod: New test. * gm2/projects/pim/run/pass/tower/AdvParse.bnf: New test. * gm2/projects/pim/run/pass/tower/AdvParse.def: New test. * gm2/projects/pim/run/pass/tower/AdvParse.mod: New test. * gm2/projects/pim/run/pass/tower/AdvSound.def: New test. * gm2/projects/pim/run/pass/tower/AdvSound.mod: New test. * gm2/projects/pim/run/pass/tower/AdvSystem.def: New test. * gm2/projects/pim/run/pass/tower/AdvSystem.mod: New test. * gm2/projects/pim/run/pass/tower/AdvTreasure.def: New test. * gm2/projects/pim/run/pass/tower/AdvTreasure.mod: New test. * gm2/projects/pim/run/pass/tower/AdvUtil.def: New test. * gm2/projects/pim/run/pass/tower/AdvUtil.mod: New test. * gm2/projects/pim/run/pass/tower/DrawG.def: New test. * gm2/projects/pim/run/pass/tower/DrawG.mod: New test. * gm2/projects/pim/run/pass/tower/DrawL.def: New test. * gm2/projects/pim/run/pass/tower/DrawL.mod: New test. * gm2/projects/pim/run/pass/tower/Dungeon.mod: New test. * gm2/projects/pim/run/pass/tower/Lock.def: New test. * gm2/projects/pim/run/pass/tower/Lock.mod: New test. * gm2/projects/pim/run/pass/tower/ProcArgs.def: New test. * gm2/projects/pim/run/pass/tower/ProcArgs.mod: New test. * gm2/projects/pim/run/pass/tower/Screen.def: New test. * gm2/projects/pim/run/pass/tower/Screen.mod: New test. * gm2/projects/pim/run/pass/tower/SocketControl.c: New test. * gm2/projects/pim/run/pass/tower/SocketControl.def: New test. * gm2/projects/pim/run/pass/tower/Window.def: New test. * gm2/projects/pim/run/pass/tower/Window.mod: New test. * gm2/projects/pim/run/pass/tower/adv.flex: New test. * gm2/projects/pim/run/pass/tower/advflex.c: New test. * gm2/projects/pim/run/pass/tower/advflex.def: New test. * gm2/projects/pim/run/pass/tower/projects-pim-run-pass-tower.exp: New test. * gm2/projects/pim/run/pass/tower/star: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
Diffstat (limited to 'gcc/m2/gm2-libs/RTint.mod')
-rw-r--r--gcc/m2/gm2-libs/RTint.mod399
1 files changed, 199 insertions, 200 deletions
diff --git a/gcc/m2/gm2-libs/RTint.mod b/gcc/m2/gm2-libs/RTint.mod
index d8ca8dd..97fdee2 100644
--- a/gcc/m2/gm2-libs/RTint.mod
+++ b/gcc/m2/gm2-libs/RTint.mod
@@ -97,21 +97,21 @@ END Min ;
(*
- FindVector - searches the exists list for a vector of type, t,
+ FindVector - searches the exists list for a vector of type
which is associated with file descriptor, fd.
*)
-PROCEDURE FindVector (fd: INTEGER; t: VectorType) : Vector ;
+PROCEDURE FindVector (fd: INTEGER; type: VectorType) : Vector ;
VAR
- v: Vector ;
+ vec: Vector ;
BEGIN
- v := Exists ;
- WHILE v#NIL DO
- IF (v^.type=t) AND (v^.File=fd)
+ vec := Exists ;
+ WHILE vec#NIL DO
+ IF (vec^.type=type) AND (vec^.File=fd)
THEN
- RETURN v
+ RETURN vec
END ;
- v := v^.exists
+ vec := vec^.exists
END ;
RETURN NIL
END FindVector ;
@@ -124,19 +124,19 @@ END FindVector ;
PROCEDURE InitInputVector (fd: INTEGER; pri: CARDINAL) : CARDINAL ;
VAR
- v: Vector ;
+ vptr: Vector ;
BEGIN
IF Debugging
THEN
printf("InitInputVector fd = %d priority = %d\n", fd, pri)
END ;
wait (lock) ;
- v := FindVector(fd, input) ;
- IF v=NIL
+ vptr := FindVector(fd, input) ;
+ IF vptr = NIL
THEN
- NEW(v) ;
- INC(VecNo) ;
- WITH v^ DO
+ NEW (vptr) ;
+ INC (VecNo) ;
+ WITH vptr^ DO
type := input ;
priority := pri ;
arg := NIL ;
@@ -145,12 +145,12 @@ BEGIN
no := VecNo ;
File := fd
END ;
- Exists := v ;
+ Exists := vptr ;
signal (lock) ;
RETURN VecNo
ELSE
signal (lock) ;
- RETURN v^.no
+ RETURN vptr^.no
END
END InitInputVector ;
@@ -162,19 +162,19 @@ END InitInputVector ;
PROCEDURE InitOutputVector (fd: INTEGER; pri: CARDINAL) : CARDINAL ;
VAR
- v: Vector ;
+ vptr: Vector ;
BEGIN
wait (lock) ;
- v := FindVector (fd, output) ;
- IF v=NIL
+ vptr := FindVector (fd, output) ;
+ IF vptr = NIL
THEN
- NEW (v) ;
- IF v = NIL
+ NEW (vptr) ;
+ IF vptr = NIL
THEN
HALT
ELSE
INC (VecNo) ;
- WITH v^ DO
+ WITH vptr^ DO
type := output ;
priority := pri ;
arg := NIL ;
@@ -183,13 +183,13 @@ BEGIN
no := VecNo ;
File := fd
END ;
- Exists := v ;
+ Exists := vptr ;
signal (lock) ;
RETURN VecNo
END
ELSE
signal (lock) ;
- RETURN v^.no
+ RETURN vptr^.no
END
END InitOutputVector ;
@@ -201,28 +201,28 @@ END InitOutputVector ;
PROCEDURE InitTimeVector (micro, secs: CARDINAL; pri: CARDINAL) : CARDINAL ;
VAR
- v: Vector ;
+ vptr: Vector ;
BEGIN
wait (lock) ;
- NEW (v) ;
- IF v = NIL
+ NEW (vptr) ;
+ IF vptr = NIL
THEN
HALT
ELSE
INC (VecNo) ;
Assert (micro<Microseconds) ;
- WITH v^ DO
+ WITH vptr^ DO
type := time ;
priority := pri ;
arg := NIL ;
pending := NIL ;
exists := Exists ;
no := VecNo ;
- rel := InitTime(secs+DebugTime, micro) ;
- abs := InitTime(0, 0) ;
+ rel := InitTime (secs+DebugTime, micro) ;
+ abs := InitTime (0, 0) ;
queued := FALSE
END ;
- Exists := v
+ Exists := vptr
END ;
signal (lock) ;
RETURN VecNo
@@ -230,18 +230,18 @@ END InitTimeVector ;
(*
- FindVectorNo - searches the Exists list for vector, vec.
+ FindVectorNo - searches the Exists list for vector vec.
*)
PROCEDURE FindVectorNo (vec: CARDINAL) : Vector ;
VAR
- v: Vector ;
+ vptr: Vector ;
BEGIN
- v := Exists ;
- WHILE (v#NIL) AND (v^.no#vec) DO
- v := v^.exists
+ vptr := Exists ;
+ WHILE (vptr#NIL) AND (vptr^.no#vec) DO
+ vptr := vptr^.exists
END ;
- RETURN v
+ RETURN vptr
END FindVectorNo ;
@@ -251,17 +251,17 @@ END FindVectorNo ;
PROCEDURE FindPendingVector (vec: CARDINAL) : Vector ;
VAR
- i: CARDINAL ;
- v: Vector ;
+ pri : CARDINAL ;
+ vptr: Vector ;
BEGIN
- FOR i := MIN(PROTECTION) TO MAX(PROTECTION) DO
- v := Pending[i] ;
- WHILE (v#NIL) AND (v^.no#vec) DO
- v := v^.pending
+ FOR pri := MIN(PROTECTION) TO MAX(PROTECTION) DO
+ vptr := Pending[pri] ;
+ WHILE (vptr#NIL) AND (vptr^.no#vec) DO
+ vptr := vptr^.pending
END ;
- IF (v#NIL) AND (v^.no=vec)
+ IF (vptr#NIL) AND (vptr^.no=vec)
THEN
- RETURN v
+ RETURN vptr
END
END ;
RETURN NIL
@@ -276,17 +276,17 @@ END FindPendingVector ;
PROCEDURE ReArmTimeVector (vec: CARDINAL;
micro, secs: CARDINAL) ;
VAR
- v: Vector ;
+ vptr: Vector ;
BEGIN
- Assert(micro<Microseconds) ;
+ Assert (micro<Microseconds) ;
wait (lock) ;
- v := FindVectorNo(vec) ;
- IF v=NIL
+ vptr := FindVectorNo (vec) ;
+ IF vptr = NIL
THEN
- Halt(__FILE__, __LINE__, __FUNCTION__,
- 'cannot find vector supplied')
+ Halt (__FILE__, __LINE__, __FUNCTION__,
+ 'cannot find vector supplied')
ELSE
- WITH v^ DO
+ WITH vptr^ DO
SetTime (rel, secs + DebugTime, micro)
END
END ;
@@ -303,16 +303,16 @@ END ReArmTimeVector ;
PROCEDURE GetTimeVector (vec: CARDINAL; VAR micro, secs: CARDINAL) ;
VAR
- v: Vector ;
+ vptr: Vector ;
BEGIN
wait (lock) ;
- v := FindVectorNo (vec) ;
- IF v=NIL
+ vptr := FindVectorNo (vec) ;
+ IF vptr=NIL
THEN
- Halt(__FILE__, __LINE__, __FUNCTION__,
- 'cannot find vector supplied')
+ Halt (__FILE__, __LINE__, __FUNCTION__,
+ 'cannot find vector supplied')
ELSE
- WITH v^ DO
+ WITH vptr^ DO
GetTime (rel, secs, micro) ;
Assert (micro < Microseconds)
END
@@ -322,31 +322,31 @@ END GetTimeVector ;
(*
- AttachVector - adds the pointer, p, to be associated with the interrupt
+ AttachVector - adds the pointer ptr to be associated with the interrupt
vector. It returns the previous value attached to this
vector.
*)
-PROCEDURE AttachVector (vec: CARDINAL; p: ADDRESS) : ADDRESS ;
+PROCEDURE AttachVector (vec: CARDINAL; ptr: ADDRESS) : ADDRESS ;
VAR
- v: Vector ;
- l: ADDRESS ;
+ vptr : Vector ;
+ prevArg: ADDRESS ;
BEGIN
wait (lock) ;
- v := FindVectorNo (vec) ;
- IF v=NIL
+ vptr := FindVectorNo (vec) ;
+ IF vptr = NIL
THEN
Halt (__FILE__, __LINE__, __FUNCTION__, 'cannot find vector supplied')
ELSE
- l := v^.arg ;
- v^.arg := p ;
+ prevArg := vptr^.arg ;
+ vptr^.arg := ptr ;
IF Debugging
THEN
- printf ("AttachVector %d with 0x%x\n", vec, p);
+ printf ("AttachVector %d with %p\n", vec, ptr);
DumpPendingQueue ;
END ;
signal (lock) ;
- RETURN l
+ RETURN prevArg
END
END AttachVector ;
@@ -358,42 +358,41 @@ END AttachVector ;
PROCEDURE IncludeVector (vec: CARDINAL) ;
VAR
- v : Vector ;
- m, s: CARDINAL ;
- r : INTEGER ;
+ vptr : Vector ;
+ micro, sec: CARDINAL ;
+ result : INTEGER ;
BEGIN
wait (lock) ;
- v := FindPendingVector (vec) ;
- IF v=NIL
+ vptr := FindPendingVector (vec) ;
+ IF vptr = NIL
THEN
- v := FindVectorNo (vec) ;
- IF v = NIL
+ vptr := FindVectorNo (vec) ;
+ IF vptr = NIL
THEN
Halt (__FILE__, __LINE__, __FUNCTION__,
'cannot find vector supplied') ;
ELSE
(* printf('including vector %d (fd = %d)\n', vec, v^.File) ; *)
- v^.pending := Pending[v^.priority] ;
- Pending[v^.priority] := v ;
- IF (v^.type = time) AND (NOT v^.queued)
+ vptr^.pending := Pending[vptr^.priority] ;
+ Pending[vptr^.priority] := vptr ;
+ IF (vptr^.type = time) AND (NOT vptr^.queued)
THEN
- v^.queued := TRUE ;
- r := GetTimeOfDay (v^.abs) ;
- Assert (r=0) ;
- GetTime (v^.abs, s, m) ;
- Assert (m<Microseconds) ;
- AddTime (v^.abs, v^.rel) ;
- GetTime (v^.abs, s, m) ;
- Assert (m<Microseconds)
+ vptr^.queued := TRUE ;
+ result := GetTimeOfDay (vptr^.abs) ;
+ Assert (result=0) ;
+ GetTime (vptr^.abs, sec, micro) ;
+ Assert (micro<Microseconds) ;
+ AddTime (vptr^.abs, vptr^.rel) ;
+ GetTime (vptr^.abs, sec, micro) ;
+ Assert (micro<Microseconds)
END
END
ELSE
IF Debugging
THEN
- printf ('odd vector (%d) type (%d) arg (0x%x) is already attached to the pending queue\n',
- vec, v^.type, v^.arg)
- END ;
- stop
+ printf ('odd vector (%d) type (%d) arg (%p) is already attached to the pending queue\n',
+ vec, vptr^.type, vptr^.arg)
+ END
END ;
signal (lock)
END IncludeVector ;
@@ -406,29 +405,29 @@ END IncludeVector ;
PROCEDURE ExcludeVector (vec: CARDINAL) ;
VAR
- v, u: Vector ;
+ vptr, uptr: Vector ;
BEGIN
wait (lock) ;
- v := FindPendingVector(vec) ;
- IF v=NIL
+ vptr := FindPendingVector (vec) ;
+ IF vptr = NIL
THEN
Halt (__FILE__, __LINE__, __FUNCTION__,
'cannot find pending vector supplied')
ELSE
(* printf('excluding vector %d\n', vec) ; *)
- IF Pending[v^.priority]=v
+ IF Pending[vptr^.priority] = vptr
THEN
- Pending[v^.priority] := Pending[v^.priority]^.pending
+ Pending[vptr^.priority] := Pending[vptr^.priority]^.pending
ELSE
- u := Pending[v^.priority] ;
- WHILE u^.pending#v DO
- u := u^.pending
+ uptr := Pending[vptr^.priority] ;
+ WHILE uptr^.pending#vptr DO
+ uptr := uptr^.pending
END ;
- u^.pending := v^.pending
+ uptr^.pending := vptr^.pending
END ;
- IF v^.type=time
+ IF vptr^.type=time
THEN
- v^.queued := FALSE
+ vptr^.queued := FALSE
END
END ;
signal (lock)
@@ -436,18 +435,18 @@ END ExcludeVector ;
(*
- AddFd - adds the file descriptor, fd, to set, s, updating, max.
+ AddFd - adds the file descriptor fd to set updating max.
*)
-PROCEDURE AddFd (VAR s: SetOfFd; VAR max: INTEGER; fd: INTEGER) ;
+PROCEDURE AddFd (VAR set: SetOfFd; VAR max: INTEGER; fd: INTEGER) ;
BEGIN
max := Max (fd, max) ;
- IF s = NIL
+ IF set = NIL
THEN
- s := InitSet () ;
- FdZero (s)
+ set := InitSet () ;
+ FdZero (set)
END ;
- FdSet (fd, s)
+ FdSet (fd, set)
(* printf('%d, ', fd) *)
END AddFd ;
@@ -458,36 +457,33 @@ END AddFd ;
PROCEDURE DumpPendingQueue ;
VAR
- p : PROTECTION ;
- v : Vector ;
- s, m: CARDINAL ;
+ pri : PROTECTION ;
+ vptr : Vector ;
+ sec,
+ micro: CARDINAL ;
BEGIN
printf ("Pending queue\n");
- FOR p := MIN (PROTECTION) TO MAX (PROTECTION) DO
- printf ("[%d] ", p);
- v := Pending[p] ;
- WHILE v#NIL DO
- IF (v^.type=input) OR (v^.type=output)
+ FOR pri := MIN (PROTECTION) TO MAX (PROTECTION) DO
+ printf ("[%d] ", pri);
+ vptr := Pending[pri] ;
+ WHILE vptr # NIL DO
+ IF (vptr^.type=input) OR (vptr^.type=output)
THEN
- printf ("(fd=%d) (vec=%d)", v^.File, v^.no)
- ELSIF v^.type=time
+ printf ("(fd=%d) (vec=%d)", vptr^.File, vptr^.no)
+ ELSIF vptr^.type=time
THEN
- GetTime(v^.rel, s, m) ;
- Assert (m<Microseconds) ;
- printf ("time (%u.%06u secs) (arg = 0x%x)\n", s, m, v^.arg)
+ GetTime (vptr^.rel, sec, micro) ;
+ Assert (micro < Microseconds) ;
+ printf ("time (%u.%06u secs) (arg = %p)\n",
+ sec, micro, vptr^.arg)
END ;
- v := v^.pending
+ vptr := vptr^.pending
END ;
printf (" \n")
END
END DumpPendingQueue ;
-PROCEDURE stop ;
-BEGIN
-END stop ;
-
-
(*
AddTime - t1 := t1 + t2
*)
@@ -565,63 +561,64 @@ END SubTime ;
*)
PROCEDURE activatePending (untilInterrupt: BOOLEAN; call: DispatchVector; pri: CARDINAL;
- maxFd: INTEGER; VAR i, o: SetOfFd; VAR t: Timeval; b4, after: Timeval) : BOOLEAN ;
+ maxFd: INTEGER; VAR inSet, outSet: SetOfFd; VAR timeval: Timeval; b4, after: Timeval) : BOOLEAN ;
VAR
- r : INTEGER ;
- p : CARDINAL ;
- v : Vector ;
+ result: INTEGER ;
+ p : CARDINAL ;
+ vec : Vector ;
b4s,
b4m,
afs,
afm,
- s, m: CARDINAL ;
+ sec,
+ micro : CARDINAL ;
BEGIN
wait (lock) ;
p := MAX (PROTECTION) ;
WHILE p > pri DO
- v := Pending[p] ;
- WHILE v # NIL DO
- WITH v^ DO
+ vec := Pending[p] ;
+ WHILE vec # NIL DO
+ WITH vec^ DO
CASE type OF
- input : IF (File < maxFd) AND (i # NIL) AND FdIsSet (File, i)
+ input : IF (File < maxFd) AND (inSet # NIL) AND FdIsSet (File, inSet)
THEN
IF Debugging
THEN
printf ('read (fd=%d) is ready (vec=%d)\n', File, no) ;
DumpPendingQueue
END ;
- FdClr (File, i) ; (* so we dont activate this again from our select. *)
+ FdClr (File, inSet) ; (* so we dont activate this again from our select. *)
signal (lock) ;
call (no, priority, arg) ;
RETURN TRUE
END |
- output: IF (File < maxFd) AND (o#NIL) AND FdIsSet (File, o)
+ output: IF (File < maxFd) AND (outSet#NIL) AND FdIsSet (File, outSet)
THEN
IF Debugging
THEN
printf ('write (fd=%d) is ready (vec=%d)\n', File, no) ;
DumpPendingQueue
END ;
- FdClr (File, o) ; (* so we dont activate this again from our select. *)
+ FdClr (File, outSet) ; (* so we dont activate this again from our select. *)
signal (lock) ;
call (no, priority, arg) ;
RETURN TRUE
END |
- time : IF untilInterrupt AND (t # NIL)
+ time : IF untilInterrupt AND (timeval # NIL)
THEN
- r := GetTimeOfDay (after) ;
- Assert (r=0) ;
+ result := GetTimeOfDay (after) ;
+ Assert (result=0) ;
IF Debugging
THEN
- GetTime (t, s, m) ;
- Assert (m < Microseconds) ;
+ GetTime (timeval, sec, micro) ;
+ Assert (micro < Microseconds) ;
GetTime (after, afs, afm) ;
Assert (afm < Microseconds) ;
GetTime (b4, b4s, b4m) ;
Assert (b4m < Microseconds) ;
printf ("waited %u.%06u + %u.%06u now is %u.%06u\n",
- s, m, b4s, b4m, afs, afm) ;
+ sec, micro, b4s, b4m, afs, afm) ;
END ;
IF IsGreaterEqual (after, abs)
THEN
@@ -630,7 +627,7 @@ BEGIN
DumpPendingQueue ;
printf ("time has expired calling dispatcher\n")
END ;
- t := KillTime (t) ; (* so we dont activate this again from our select. *)
+ timeval := KillTime (timeval) ; (* so we dont activate this again from our select. *)
signal (lock) ;
IF Debugging
THEN
@@ -645,7 +642,7 @@ BEGIN
END
END
END ;
- v := v^.pending
+ vec := vec^.pending
END ;
DEC (p)
END ;
@@ -667,20 +664,22 @@ PROCEDURE Listen (untilInterrupt: BOOLEAN;
call: DispatchVector;
pri: CARDINAL) ;
VAR
- found: BOOLEAN ;
- r : INTEGER ;
+ found : BOOLEAN ;
+ result : INTEGER ;
after,
b4,
- t : Timeval ;
- v : Vector ;
- i, o : SetOfFd ;
+ timeval: Timeval ;
+ vec : Vector ;
+ inSet,
+ outSet : SetOfFd ;
b4s,
b4m,
afs,
afm,
- s, m : CARDINAL ;
- maxFd: INTEGER ;
- p : CARDINAL ;
+ sec,
+ micro : CARDINAL ;
+ maxFd : INTEGER ;
+ p : CARDINAL ;
BEGIN
wait (lock) ;
IF pri < MAX (PROTECTION)
@@ -690,120 +689,120 @@ BEGIN
DumpPendingQueue
END ;
maxFd := -1 ;
- t := NIL ;
- i := NIL ;
- o := NIL ;
- t := InitTime (MAX (INTEGER), 0) ;
+ timeval := NIL ;
+ inSet := NIL ;
+ outSet := NIL ;
+ timeval := InitTime (MAX (INTEGER), 0) ;
p := MAX (PROTECTION) ;
found := FALSE ;
WHILE p>pri DO
- v := Pending[p] ;
- WHILE v#NIL DO
- WITH v^ DO
+ vec := Pending[p] ;
+ WHILE vec#NIL DO
+ WITH vec^ DO
CASE type OF
- input : AddFd (i, maxFd, File) |
- output: AddFd (o, maxFd, File) |
- time : IF IsGreaterEqual (t, abs)
+ input : AddFd (inSet, maxFd, File) |
+ output: AddFd (outSet, maxFd, File) |
+ time : IF IsGreaterEqual (timeval, abs)
THEN
- GetTime (abs, s, m) ;
- Assert (m<Microseconds) ;
+ GetTime (abs, sec, micro) ;
+ Assert (micro < Microseconds) ;
IF Debugging
THEN
- printf ("shortest delay is %u.%06u\n", s, m)
+ printf ("shortest delay is %u.%06u\n", sec, micro)
END ;
- SetTime (t, s, m) ;
+ SetTime (timeval, sec, micro) ;
found := TRUE
END
END
END ;
- v := v^.pending
+ vec := vec^.pending
END ;
DEC (p)
END ;
IF NOT untilInterrupt
THEN
- SetTime (t, 0, 0)
+ SetTime (timeval, 0, 0)
END ;
- IF untilInterrupt AND (i=NIL) AND (o=NIL) AND (NOT found)
+ IF untilInterrupt AND (inSet=NIL) AND (outSet=NIL) AND (NOT found)
THEN
Halt (__FILE__, __LINE__, __FUNCTION__,
'deadlock found, no more processes to run and no interrupts active')
END ;
- (* printf('timeval = 0x%x\n', t) ; *)
+ (* printf('timeval = 0x%x\n', timeval) ; *)
(* printf('}\n') ; *)
- IF (NOT found) AND (maxFd=-1) AND (i=NIL) AND (o=NIL)
+ IF (NOT found) AND (maxFd=-1) AND (inSet=NIL) AND (outSet=NIL)
THEN
(* no file descriptors to be selected upon. *)
- t := KillTime (t) ;
+ timeval := KillTime (timeval) ;
signal (lock) ;
RETURN
ELSE
- GetTime (t, s, m) ;
- Assert (m<Microseconds) ;
+ GetTime (timeval, sec, micro) ;
+ Assert (micro < Microseconds) ;
b4 := InitTime (0, 0) ;
after := InitTime (0, 0) ;
- r := GetTimeOfDay (b4) ;
- Assert (r=0) ;
- SubTime (s, m, t, b4) ;
- SetTime (t, s, m) ;
+ result := GetTimeOfDay (b4) ;
+ Assert (result=0) ;
+ SubTime (sec, micro, timeval, b4) ;
+ SetTime (timeval, sec, micro) ;
IF Debugging
THEN
- printf ("select waiting for %u.%06u seconds\n", s, m)
+ printf ("select waiting for %u.%06u seconds\n", sec, micro)
END ;
signal (lock) ;
REPEAT
IF Debugging
THEN
- printf ("select (.., .., .., %u.%06u)\n", s, m)
+ printf ("select (.., .., .., %u.%06u)\n", sec, micro)
END ;
- r := select (maxFd+1, i, o, NIL, t) ;
- IF r=-1
+ result := select (maxFd+1, inSet, outSet, NIL, timeval) ;
+ IF result=-1
THEN
perror ("select") ;
- r := select (maxFd+1, i, o, NIL, NIL) ;
- IF r=-1
+ result := select (maxFd+1, inSet, outSet, NIL, NIL) ;
+ IF result=-1
THEN
perror ("select timeout argument is faulty")
END ;
- r := select (maxFd+1, i, NIL, NIL, t) ;
- IF r=-1
+ result := select (maxFd+1, inSet, NIL, NIL, timeval) ;
+ IF result=-1
THEN
perror ("select output fd argument is faulty")
END ;
- r := select (maxFd+1, NIL, o, NIL, t) ;
- IF r=-1
+ result := select (maxFd+1, NIL, outSet, NIL, timeval) ;
+ IF result=-1
THEN
perror ("select input fd argument is faulty")
ELSE
perror ("select maxFD+1 argument is faulty")
END
END
- UNTIL r#-1
+ UNTIL result#-1
END ;
WHILE activatePending (untilInterrupt, call, pri,
- maxFd+1, i, o, t, b4, after) DO
+ maxFd+1, inSet, outSet, timeval, b4, after) DO
END ;
- IF t#NIL
+ IF timeval#NIL
THEN
- t := KillTime (t)
+ timeval := KillTime (timeval)
END ;
IF after#NIL
THEN
- t := KillTime (after)
+ after := KillTime (after)
END ;
IF b4#NIL
THEN
- t := KillTime (b4)
+ b4 := KillTime (b4)
END ;
- IF i#NIL
+ IF inSet#NIL
THEN
- i := KillSet (i)
+ inSet := KillSet (inSet)
END ;
- IF o#NIL
+ IF outSet#NIL
THEN
- o := KillSet (o)
+ outSet := KillSet (outSet)
END
END ;
signal (lock)