code:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1386491679 &1
PresetManager:
  m_ObjectHideFlags: 0
  m_DefaultList:
  - type:
      m_NativeTypeID: 108
      m_ManagedTypePPtr: {fileID: 0}
      m_ManagedTypeFallback:
    defaultPresets:
    - m_Preset: {fileID: 2655988077585873504, guid: 463065d4f17d1d94d848aa127b94dd43,
        type: 2}
  - type:
      m_NativeTypeID: 1020
      m_ManagedTypePPtr: {fileID: 0}
      m_ManagedTypeFallback:
    defaultPresets:
    - m_Preset: {fileID: 2655988077585873504, guid: e7689051185d12f4298e1ebb2693a29f,
        type: 2}
  - type:
      m_NativeTypeID: 1006
      m_ManagedTypePPtr: {fileID: 0}
      m_ManagedTypeFallback:
    defaultPresets:
    - m_Preset: {fileID: 2655988077585873504, guid: e8537455c6c08bd4e8bf0be3707da685,
        type: 2}


code:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!129 &1
PlayerSettings:
  m_ObjectHideFlags: 0
  serializedVersion: 18
  productGUID: 4ed4793315b6ae84b90fe4aa2cbb9787
  AndroidProfiler: 0
  AndroidFilterTouchesWhenObscured: 0
  AndroidEnableSustainedPerformanceMode: 0
  defaultScreenOrientation: 4
  targetDevice: 2
  useOnDemandResources: 0
  accelerometerFrequency: 60
  companyName: DefaultCompany
  productName: ESPa
  defaultCursor: {fileID: 0}
  cursorHotspot: {x: 0, y: 0}
  m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1}
  m_ShowUnitySplashScreen: 1
  m_ShowUnitySplashLogo: 1
  m_SplashScreenOverlayOpacity: 1
  m_SplashScreenAnimation: 1
  m_SplashScreenLogoStyle: 1
  m_SplashScreenDrawMode: 0
  m_SplashScreenBackgroundAnimationZoom: 1
  m_SplashScreenLogoAnimationZoom: 1
  m_SplashScreenBackgroundLandscapeAspect: 1
  m_SplashScreenBackgroundPortraitAspect: 1
  m_SplashScreenBackgroundLandscapeUvs:
    serializedVersion: 2
    x: 0
    y: 0
    width: 1
    height: 1
  m_SplashScreenBackgroundPortraitUvs:
    serializedVersion: 2
    x: 0
    y: 0
    width: 1
    height: 1
  m_SplashScreenLogos: []
  m_VirtualRealitySplashScreen: {fileID: 0}
  m_HolographicTrackingLossScreen: {fileID: 0}
  defaultScreenWidth: 1024
  defaultScreenHeight: 768
  defaultScreenWidthWeb: 960
  defaultScreenHeightWeb: 600
  m_StereoRenderingPath: 0
  m_ActiveColorSpace: 1
  m_MTRendering: 1
  m_StackTraceTypes: 010000000100000001000000010000000100000001000000
  iosShowActivityIndicatorOnLoading: -1
  androidShowActivityIndicatorOnLoading: -1
  displayResolutionDialog: 0
  iosUseCustomAppBackgroundBehavior: 0
  iosAllowHTTPDownload: 1
  allowedAutorotateToPortrait: 1
  allowedAutorotateToPortraitUpsideDown: 1
  allowedAutorotateToLandscapeRight: 1
  allowedAutorotateToLandscapeLeft: 1
  useOSAutorotation: 1
  use32BitDisplayBuffer: 1
  preserveFramebufferAlpha: 0
  disableDepthAndStencilBuffers: 0
  androidStartInFullscreen: 1
  androidRenderOutsideSafeArea: 0
  androidUseSwappy: 0
  androidBlitType: 1
  defaultIsNativeResolution: 1
  macRetinaSupport: 1
  runInBackground: 1
  captureSingleScreen: 0
  muteOtherAudioSources: 0
  Prepare IOS For Recording: 0
  Force IOS Speakers When Recording: 0
  deferSystemGesturesMode: 0
  hideHomeButton: 0
  submitAnalytics: 1
  usePlayerLog: 1
  bakeCollisionMeshes: 0
  forceSingleInstance: 0
  useFlipModelSwapchain: 1
  resizableWindow: 0
  useMacAppStoreValidation: 0
  macAppStoreCategory: public.app-category.games
  gpuSkinning: 1
  graphicsJobs: 1
  xboxPIXTextureCapture: 0
  xboxEnableAvatar: 0
  xboxEnableKinect: 0
  xboxEnableKinectAutoTracking: 0
  xboxEnableFitness: 0
  visibleInBackground: 1
  allowFullscreenSwitch: 1
  graphicsJobMode: 0
  fullscreenMode: 1
  xboxSpeechDB: 0
  xboxEnableHeadOrientation: 0
  xboxEnableGuest: 0
  xboxEnablePIXSampling: 0
  metalFramebufferOnly: 0
  xboxOneResolution: 0
  xboxOneSResolution: 0
  xboxOneXResolution: 3
  xboxOneMonoLoggingLevel: 0
  xboxOneLoggingLevel: 1
  xboxOneDisableEsram: 0
  xboxOnePresentImmediateThreshold: 0
  switchQueueCommandMemory: 0
  switchQueueControlMemory: 0
  switchQueueComputeMemory: 262144
  switchNVNShaderPoolsGranularity: 33554432
  switchNVNDefaultPoolsGranularity: 16777216
  switchNVNOtherPoolsGranularity: 16777216
  vulkanEnableSetSRGBWrite: 0
  m_SupportedAspectRatios:
    4:3: 1
    5:4: 1
    16:10: 1
    16:9: 1
    Others: 1
  bundleVersion: 0.1
  preloadedAssets: []
  metroInputSource: 0
  wsaTransparentSwapchain: 0
  m_HolographicPauseOnTrackingLoss: 1
  xboxOneDisableKinectGpuReservation: 1
  xboxOneEnable7thCore: 1
  vrSettings:
    cardboard:
      depthFormat: 0
      enableTransitionView: 0
    daydream:
      depthFormat: 0
      useSustainedPerformanceMode: 0
      enableVideoLayer: 0
      useProtectedVideoMemory: 0
      minimumSupportedHeadTracking: 0
      maximumSupportedHeadTracking: 1
    hololens:
      depthFormat: 1
      depthBufferSharingEnabled: 1
    lumin:
      depthFormat: 0
      frameTiming: 2
      enableGLCache: 0
      glCacheMaxBlobSize: 524288
      glCacheMaxFileSize: 8388608
    oculus:
      sharedDepthBuffer: 1
      dashSupport: 1
      lowOverheadMode: 0
      protectedContext: 0
      v2Signing: 0
    enable360StereoCapture: 0
  isWsaHolographicRemotingEnabled: 0
  protectGraphicsMemory: 0
  enableFrameTimingStats: 0
  useHDRDisplay: 0
  m_ColorGamuts: 0000000003000000
  targetPixelDensity: 30
  resolutionScalingMode: 0
  androidSupportedAspectRatio: 1
  androidMaxAspectRatio: 2.1
  applicationIdentifier: {}
  buildNumber: {}
  AndroidBundleVersionCode: 1
  AndroidMinSdkVersion: 18
  AndroidTargetSdkVersion: 0
  AndroidPreferredInstallLocation: 1
  aotOptions:
  stripEngineCode: 1
  iPhoneStrippingLevel: 0
  iPhoneScriptCallOptimization: 0
  ForceInternetPermission: 0
  ForceSDCardPermission: 0
  CreateWallpaper: 0
  APKExpansionFiles: 0
  keepLoadedShadersAlive: 0
  StripUnusedMeshComponents: 1
  VertexChannelCompressionMask: 4054
  iPhoneSdkVersion: 988
  iOSTargetOSVersionString: 9.0
  tvOSSdkVersion: 0
  tvOSRequireExtendedGameController: 0
  tvOSTargetOSVersionString: 9.0
  uIPrerenderedIcon: 0
  uIRequiresPersistentWiFi: 0
  uIRequiresFullScreen: 1
  uIStatusBarHidden: 1
  uIExitOnSuspend: 0
  uIStatusBarStyle: 0
  iPhoneSplashScreen: {fileID: 0}
  iPhoneHighResSplashScreen: {fileID: 0}
  iPhoneTallHighResSplashScreen: {fileID: 0}
  iPhone47inSplashScreen: {fileID: 0}
  iPhone55inPortraitSplashScreen: {fileID: 0}
  iPhone55inLandscapeSplashScreen: {fileID: 0}
  iPhone58inPortraitSplashScreen: {fileID: 0}
  iPhone58inLandscapeSplashScreen: {fileID: 0}
  iPadPortraitSplashScreen: {fileID: 0}
  iPadHighResPortraitSplashScreen: {fileID: 0}
  iPadLandscapeSplashScreen: {fileID: 0}
  iPadHighResLandscapeSplashScreen: {fileID: 0}
  iPhone65inPortraitSplashScreen: {fileID: 0}
  iPhone65inLandscapeSplashScreen: {fileID: 0}
  iPhone61inPortraitSplashScreen: {fileID: 0}
  iPhone61inLandscapeSplashScreen: {fileID: 0}
  appleTVSplashScreen: {fileID: 0}
  appleTVSplashScreen2x: {fileID: 0}
  tvOSSmallIconLayers: []
  tvOSSmallIconLayers2x: []
  tvOSLargeIconLayers: []
  tvOSLargeIconLayers2x: []
  tvOSTopShelfImageLayers: []
  tvOSTopShelfImageLayers2x: []
  tvOSTopShelfImageWideLayers: []
  tvOSTopShelfImageWideLayers2x: []
  iOSLaunchScreenType: 0
  iOSLaunchScreenPortrait: {fileID: 0}
  iOSLaunchScreenLandscape: {fileID: 0}
  iOSLaunchScreenBackgroundColor:
    serializedVersion: 2
    rgba: 0
  iOSLaunchScreenFillPct: 100
  iOSLaunchScreenSize: 100
  iOSLaunchScreenCustomXibPath:
  iOSLaunchScreeniPadType: 0
  iOSLaunchScreeniPadImage: {fileID: 0}
  iOSLaunchScreeniPadBackgroundColor:
    serializedVersion: 2
    rgba: 0
  iOSLaunchScreeniPadFillPct: 100
  iOSLaunchScreeniPadSize: 100
  iOSLaunchScreeniPadCustomXibPath:
  iOSUseLaunchScreenStoryboard: 0
  iOSLaunchScreenCustomStoryboardPath:
  iOSDeviceRequirements: []
  iOSURLSchemes: []
  iOSBackgroundModes: 0
  iOSMetalForceHardShadows: 0
  metalEditorSupport: 1
  metalAPIValidation: 1
  iOSRenderExtraFrameOnPause: 0
  appleDeveloperTeamID:
  iOSManualSigningProvisioningProfileID:
  tvOSManualSigningProvisioningProfileID:
  iOSManualSigningProvisioningProfileType: 0
  tvOSManualSigningProvisioningProfileType: 0
  appleEnableAutomaticSigning: 0
  iOSRequireARKit: 0
  iOSAutomaticallyDetectAndAddCapabilities: 1
  appleEnableProMotion: 0
  clonedFromGUID: 9870af204204ab84596f8a656f2f2ce6
  templatePackageId: com.unity.template.lightweight@2.8.1
  templateDefaultScene: Assets/Scenes/SampleScene.unity
  AndroidTargetArchitectures: 1
  AndroidSplashScreenScale: 0
  androidSplashScreen: {fileID: 0}
  AndroidKeystoreName:
  AndroidKeyaliasName:
  AndroidBuildApkPerCpuArchitecture: 0
  AndroidTVCompatibility: 0
  AndroidIsGame: 1
  AndroidEnableTango: 0
  androidEnableBanner: 1
  androidUseLowAccuracyLocation: 0
  androidUseCustomKeystore: 0
  m_AndroidBanners:
  - width: 320
    height: 180
    banner: {fileID: 0}
  androidGamepadSupportLevel: 0
  AndroidValidateAppBundleSize: 1
  AndroidAppBundleSizeToValidate: 150
  resolutionDialogBanner: {fileID: 0}
  m_BuildTargetIcons: []
  m_BuildTargetPlatformIcons: []
  m_BuildTargetBatching:
  - m_BuildTarget: Standalone
    m_StaticBatching: 1
    m_DynamicBatching: 0
  - m_BuildTarget: tvOS
    m_StaticBatching: 1
    m_DynamicBatching: 0
  - m_BuildTarget: iPhone
    m_StaticBatching: 1
    m_DynamicBatching: 0
  - m_BuildTarget: Android
    m_StaticBatching: 1
    m_DynamicBatching: 0
  - m_BuildTarget: WebGL
    m_StaticBatching: 0
    m_DynamicBatching: 0
  m_BuildTargetGraphicsAPIs:
  - m_BuildTarget: iOSSupport
    m_APIs: 10000000
    m_Automatic: 0
  - m_BuildTarget: AppleTVSupport
    m_APIs: 10000000
    m_Automatic: 0
  - m_BuildTarget: AndroidPlayer
    m_APIs: 150000000b000000
    m_Automatic: 0
  - m_BuildTarget: WebGLSupport
    m_APIs: 0b000000
    m_Automatic: 0
  m_BuildTargetVRSettings: []
  openGLRequireES31: 0
  openGLRequireES31AEP: 0
  openGLRequireES32: 0
  vuforiaEnabled: 0
  m_TemplateCustomTags: {}
  mobileMTRendering:
    Android: 1
    iPhone: 1
    tvOS: 1
  m_BuildTargetGroupLightmapEncodingQuality:
  - m_BuildTarget: Standalone
    m_EncodingQuality: 1
  m_BuildTargetGroupLightmapSettings: []
  playModeTestRunnerEnabled: 0
  runPlayModeTestAsEditModeTest: 0
  actionOnDotNetUnhandledException: 1
  enableInternalProfiler: 0
  logObjCUncaughtExceptions: 1
  enableCrashReportAPI: 0
  cameraUsageDescription:
  locationUsageDescription:
  microphoneUsageDescription:
  switchNetLibKey:
  switchSocketMemoryPoolSize: 6144
  switchSocketAllocatorPoolSize: 128
  switchSocketConcurrencyLimit: 14
  switchScreenResolutionBehavior: 2
  switchUseCPUProfiler: 0
  switchApplicationID: 0x01004b9000490000
  switchNSODependencies:
  switchTitleNames_0:
  switchTitleNames_1:
  switchTitleNames_2:
  switchTitleNames_3:
  switchTitleNames_4:
  switchTitleNames_5:
  switchTitleNames_6:
  switchTitleNames_7:
  switchTitleNames_8:
  switchTitleNames_9:
  switchTitleNames_10:
  switchTitleNames_11:
  switchTitleNames_12:
  switchTitleNames_13:
  switchTitleNames_14:
  switchPublisherNames_0:
  switchPublisherNames_1:
  switchPublisherNames_2:
  switchPublisherNames_3:
  switchPublisherNames_4:
  switchPublisherNames_5:
  switchPublisherNames_6:
  switchPublisherNames_7:
  switchPublisherNames_8:
  switchPublisherNames_9:
  switchPublisherNames_10:
  switchPublisherNames_11:
  switchPublisherNames_12:
  switchPublisherNames_13:
  switchPublisherNames_14:
  switchIcons_0: {fileID: 0}
  switchIcons_1: {fileID: 0}
  switchIcons_2: {fileID: 0}
  switchIcons_3: {fileID: 0}
  switchIcons_4: {fileID: 0}
  switchIcons_5: {fileID: 0}
  switchIcons_6: {fileID: 0}
  switchIcons_7: {fileID: 0}
  switchIcons_8: {fileID: 0}
  switchIcons_9: {fileID: 0}
  switchIcons_10: {fileID: 0}
  switchIcons_11: {fileID: 0}
  switchIcons_12: {fileID: 0}
  switchIcons_13: {fileID: 0}
  switchIcons_14: {fileID: 0}
  switchSmallIcons_0: {fileID: 0}
  switchSmallIcons_1: {fileID: 0}
  switchSmallIcons_2: {fileID: 0}
  switchSmallIcons_3: {fileID: 0}
  switchSmallIcons_4: {fileID: 0}
  switchSmallIcons_5: {fileID: 0}
  switchSmallIcons_6: {fileID: 0}
  switchSmallIcons_7: {fileID: 0}
  switchSmallIcons_8: {fileID: 0}
  switchSmallIcons_9: {fileID: 0}
  switchSmallIcons_10: {fileID: 0}
  switchSmallIcons_11: {fileID: 0}
  switchSmallIcons_12: {fileID: 0}
  switchSmallIcons_13: {fileID: 0}
  switchSmallIcons_14: {fileID: 0}
  switchManualHTML:
  switchAccessibleURLs:
  switchLegalInformation:
  switchMainThreadStackSize: 1048576
  switchPresenceGroupId:
  switchLogoHandling: 0
  switchReleaseVersion: 0
  switchDisplayVersion: 1.0.0
  switchStartupUserAccount: 0
  switchTouchScreenUsage: 0
  switchSupportedLanguagesMask: 0
  switchLogoType: 0
  switchApplicationErrorCodeCategory:
  switchUserAccountSaveDataSize: 0
  switchUserAccountSaveDataJournalSize: 0
  switchApplicationAttribute: 0
  switchCardSpecSize: -1
  switchCardSpecClock: -1
  switchRatingsMask: 0
  switchRatingsInt_0: 0
  switchRatingsInt_1: 0
  switchRatingsInt_2: 0
  switchRatingsInt_3: 0
  switchRatingsInt_4: 0
  switchRatingsInt_5: 0
  switchRatingsInt_6: 0
  switchRatingsInt_7: 0
  switchRatingsInt_8: 0
  switchRatingsInt_9: 0
  switchRatingsInt_10: 0
  switchRatingsInt_11: 0
  switchLocalCommunicationIds_0:
  switchLocalCommunicationIds_1:
  switchLocalCommunicationIds_2:
  switchLocalCommunicationIds_3:
  switchLocalCommunicationIds_4:
  switchLocalCommunicationIds_5:
  switchLocalCommunicationIds_6:
  switchLocalCommunicationIds_7:
  switchParentalControl: 0
  switchAllowsScreenshot: 1
  switchAllowsVideoCapturing: 1
  switchAllowsRuntimeAddOnContentInstall: 0
  switchDataLossConfirmation: 0
  switchUserAccountLockEnabled: 0
  switchSystemResourceMemory: 16777216
  switchSupportedNpadStyles: 3
  switchNativeFsCacheSize: 32
  switchIsHoldTypeHorizontal: 0
  switchSupportedNpadCount: 8
  switchSocketConfigEnabled: 0
  switchTcpInitialSendBufferSize: 32
  switchTcpInitialReceiveBufferSize: 64
  switchTcpAutoSendBufferSizeMax: 256
  switchTcpAutoReceiveBufferSizeMax: 256
  switchUdpSendBufferSize: 9
  switchUdpReceiveBufferSize: 42
  switchSocketBufferEfficiency: 4
  switchSocketInitializeEnabled: 1
  switchNetworkInterfaceManagerInitializeEnabled: 1
  switchPlayerConnectionEnabled: 1
  ps4NPAgeRating: 12
  ps4NPTitleSecret:
  ps4NPTrophyPackPath:
  ps4ParentalLevel: 11
  ps4ContentID: ED1633-NPXX51362_00-0000000000000000
  ps4Category: 0
  ps4MasterVersion: 01.00
  ps4AppVersion: 01.00
  ps4AppType: 0
  ps4ParamSfxPath:
  ps4VideoOutPixelFormat: 0
  ps4VideoOutInitialWidth: 1920
  ps4VideoOutBaseModeInitialWidth: 1920
  ps4VideoOutReprojectionRate: 60
  ps4PronunciationXMLPath:
  ps4PronunciationSIGPath:
  ps4BackgroundImagePath:
  ps4StartupImagePath:
  ps4StartupImagesFolder:
  ps4IconImagesFolder:
  ps4SaveDataImagePath:
  ps4SdkOverride:
  ps4BGMPath:
  ps4ShareFilePath:
  ps4ShareOverlayImagePath:
  ps4PrivacyGuardImagePath:
  ps4NPtitleDatPath:
  ps4RemotePlayKeyAssignment: -1
  ps4RemotePlayKeyMappingDir:
  ps4PlayTogetherPlayerCount: 0
  ps4EnterButtonAssignment: 1
  ps4ApplicationParam1: 0
  ps4ApplicationParam2: 0
  ps4ApplicationParam3: 0
  ps4ApplicationParam4: 0
  ps4DownloadDataSize: 0
  ps4GarlicHeapSize: 2048
  ps4ProGarlicHeapSize: 2560
  playerPrefsMaxSize: 32768
  ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ
  ps4pnSessions: 1
  ps4pnPresence: 1
  ps4pnFriends: 1
  ps4pnGameCustomData: 1
  playerPrefsSupport: 0
  enableApplicationExit: 0
  resetTempFolder: 1
  restrictedAudioUsageRights: 0
  ps4UseResolutionFallback: 0
  ps4ReprojectionSupport: 0
  ps4UseAudio3dBackend: 0
  ps4SocialScreenEnabled: 0
  ps4ScriptOptimizationLevel: 0
  ps4Audio3dVirtualSpeakerCount: 14
  ps4attribCpuUsage: 0
  ps4PatchPkgPath:
  ps4PatchLatestPkgPath:
  ps4PatchChangeinfoPath:
  ps4PatchDayOne: 0
  ps4attribUserManagement: 0
  ps4attribMoveSupport: 0
  ps4attrib3DSupport: 0
  ps4attribShareSupport: 0
  ps4attribExclusiveVR: 0
  ps4disableAutoHideSplash: 0
  ps4videoRecordingFeaturesUsed: 0
  ps4contentSearchFeaturesUsed: 0
  ps4attribEyeToEyeDistanceSettingVR: 0
  ps4IncludedModules: []
  monoEnv:
  splashScreenBackgroundSourceLandscape: {fileID: 0}
  splashScreenBackgroundSourcePortrait: {fileID: 0}
  blurSplashScreenBackground: 1
  spritePackerPolicy:
  webGLMemorySize: 16
  webGLExceptionSupport: 1
  webGLNameFilesAsHashes: 0
  webGLDataCaching: 1
  webGLDebugSymbols: 0
  webGLEmscriptenArgs:
  webGLModulesDirectory:
  webGLTemplate: APPLICATION:Default
  webGLAnalyzeBuildSize: 0
  webGLUseEmbeddedResources: 0
  webGLCompressionFormat: 1
  webGLLinkerTarget: 1
  webGLThreadsSupport: 0
  webGLWasmStreaming: 0
  scriptingDefineSymbols:
    1: UNITY_POST_PROCESSING_STACK_V2;CROSS_PLATFORM_INPUT
    4: UNITY_POST_PROCESSING_STACK_V2;CROSS_PLATFORM_INPUT;MOBILE_INPUT
    7: UNITY_POST_PROCESSING_STACK_V2;CROSS_PLATFORM_INPUT;MOBILE_INPUT
    13: UNITY_POST_PROCESSING_STACK_V2
    14: UNITY_POST_PROCESSING_STACK_V2;MOBILE_INPUT
    17: UNITY_POST_PROCESSING_STACK_V2
    18: UNITY_POST_PROCESSING_STACK_V2
    19: UNITY_POST_PROCESSING_STACK_V2
    21: UNITY_POST_PROCESSING_STACK_V2
    23: UNITY_POST_PROCESSING_STACK_V2
    24: UNITY_POST_PROCESSING_STACK_V2
    25: UNITY_POST_PROCESSING_STACK_V2
    26: UNITY_POST_PROCESSING_STACK_V2
    27: UNITY_POST_PROCESSING_STACK_V2
    28: UNITY_POST_PROCESSING_STACK_V2
  platformArchitecture: {}
  scriptingBackend: {}
  il2cppCompilerConfiguration: {}
  managedStrippingLevel: {}
  incrementalIl2cppBuild: {}
  allowUnsafeCode: 0
  additionalIl2CppArgs:
  scriptingRuntimeVersion: 1
  gcIncremental: 0
  gcWBarrierValidation: 0
  apiCompatibilityLevelPerPlatform: {}
  m_RenderingPath: 1
  m_MobileRenderingPath: 1
  metroPackageName: Template_Lightweight
  metroPackageVersion:
  metroCertificatePath:
  metroCertificatePassword:
  metroCertificateSubject:
  metroCertificateIssuer:
  metroCertificateNotAfter: 0000000000000000
  metroApplicationDescription: Template_Lightweight
  wsaImages: {}
  metroTileShortName:
  metroTileShowName: 0
  metroMediumTileShowName: 0
  metroLargeTileShowName: 0
  metroWideTileShowName: 0
  metroSupportStreamingInstall: 0
  metroLastRequiredScene: 0
  metroDefaultTileSize: 1
  metroTileForegroundText: 2
  metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0}
  metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628,
    a: 1}
  metroSplashScreenUseBackgroundColor: 0
  platformCapabilities: {}
  metroTargetDeviceFamilies: {}
  metroFTAName:
  metroFTAFileTypes: []
  metroProtocolName:
  XboxOneProductId:
  XboxOneUpdateKey:
  XboxOneSandboxId:
  XboxOneContentId:
  XboxOneTitleId:
  XboxOneSCId:
  XboxOneGameOsOverridePath:
  XboxOnePackagingOverridePath:
  XboxOneAppManifestOverridePath:
  XboxOneVersion: 1.0.0.0
  XboxOnePackageEncryption: 0
  XboxOnePackageUpdateGranularity: 2
  XboxOneDescription:
  XboxOneLanguage:
  - enus
  XboxOneCapability: []
  XboxOneGameRating: {}
  XboxOneIsContentPackage: 0
  XboxOneEnableGPUVariability: 1
  XboxOneSockets: {}
  XboxOneSplashScreen: {fileID: 0}
  XboxOneAllowedProductIds: []
  XboxOnePersistentLocalStorageSize: 0
  XboxOneXTitleMemory: 8
  xboxOneScriptCompiler: 1
  XboxOneOverrideIdentityName:
  vrEditorSettings:
    daydream:
      daydreamIconForeground: {fileID: 0}
      daydreamIconBackground: {fileID: 0}
  cloudServicesEnabled:
    UNet: 1
  luminIcon:
    m_Name:
    m_ModelFolderPath:
    m_PortalFolderPath:
  luminCert:
    m_CertPath:
    m_SignPackage: 1
  luminIsChannelApp: 0
  luminVersion:
    m_VersionCode: 1
    m_VersionName:
  facebookSdkVersion: 7.9.4
  facebookAppId:
  facebookCookies: 1
  facebookLogging: 1
  facebookStatus: 1
  facebookXfbml: 0
  facebookFrictionlessRequests: 1
  apiCompatibilityLevel: 6
  cloudProjectId:
  framebufferDepthMemorylessMode: 0
  projectName:
  organizationId:
  cloudEnabled: 0
  enableNativePlatformBackendsForNewInputSystem: 0
  disableOldInputManagerSupport: 0
  legacyClampBlendShapeWeights: 0

license: unknown


code:
m_EditorVersion: 2019.2.5f1
m_EditorVersionWithRevision: 2019.2.5f1 (9dace1eed4cc)


code:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!47 &1
QualitySettings:
  m_ObjectHideFlags: 0
  serializedVersion: 5
  m_CurrentQuality: 3
  m_QualitySettings:
  - serializedVersion: 2
    name: Very Low
    pixelLightCount: 0
    shadows: 0
    shadowResolution: 0
    shadowProjection: 1
    shadowCascades: 1
    shadowDistance: 15
    shadowNearPlaneOffset: 3
    shadowCascade2Split: 0.33333334
    shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
    shadowmaskMode: 0
    skinWeights: 1
    textureQuality: 1
    anisotropicTextures: 0
    antiAliasing: 0
    softParticles: 0
    softVegetation: 0
    realtimeReflectionProbes: 0
    billboardsFaceCameraPosition: 0
    vSyncCount: 0
    lodBias: 0.3
    maximumLODLevel: 0
    streamingMipmapsActive: 0
    streamingMipmapsAddAllCameras: 1
    streamingMipmapsMemoryBudget: 512
    streamingMipmapsRenderersPerFrame: 512
    streamingMipmapsMaxLevelReduction: 2
    streamingMipmapsMaxFileIORequests: 1024
    particleRaycastBudget: 4
    asyncUploadTimeSlice: 2
    asyncUploadBufferSize: 16
    asyncUploadPersistentBuffer: 1
    resolutionScalingFixedDPIFactor: 1
    excludedTargetPlatforms: []
  - serializedVersion: 2
    name: Low
    pixelLightCount: 0
    shadows: 0
    shadowResolution: 0
    shadowProjection: 1
    shadowCascades: 1
    shadowDistance: 20
    shadowNearPlaneOffset: 3
    shadowCascade2Split: 0.33333334
    shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
    shadowmaskMode: 0
    skinWeights: 2
    textureQuality: 0
    anisotropicTextures: 0
    antiAliasing: 4
    softParticles: 0
    softVegetation: 0
    realtimeReflectionProbes: 0
    billboardsFaceCameraPosition: 0
    vSyncCount: 0
    lodBias: 0.4
    maximumLODLevel: 0
    streamingMipmapsActive: 0
    streamingMipmapsAddAllCameras: 1
    streamingMipmapsMemoryBudget: 512
    streamingMipmapsRenderersPerFrame: 512
    streamingMipmapsMaxLevelReduction: 2
    streamingMipmapsMaxFileIORequests: 1024
    particleRaycastBudget: 16
    asyncUploadTimeSlice: 2
    asyncUploadBufferSize: 16
    asyncUploadPersistentBuffer: 1
    resolutionScalingFixedDPIFactor: 1
    excludedTargetPlatforms: []
  - serializedVersion: 2
    name: Medium
    pixelLightCount: 1
    shadows: 1
    shadowResolution: 0
    shadowProjection: 1
    shadowCascades: 1
    shadowDistance: 20
    shadowNearPlaneOffset: 3
    shadowCascade2Split: 0.33333334
    shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
    shadowmaskMode: 0
    skinWeights: 2
    textureQuality: 0
    anisotropicTextures: 1
    antiAliasing: 0
    softParticles: 0
    softVegetation: 0
    realtimeReflectionProbes: 0
    billboardsFaceCameraPosition: 0
    vSyncCount: 1
    lodBias: 0.7
    maximumLODLevel: 0
    streamingMipmapsActive: 0
    streamingMipmapsAddAllCameras: 1
    streamingMipmapsMemoryBudget: 512
    streamingMipmapsRenderersPerFrame: 512
    streamingMipmapsMaxLevelReduction: 2
    streamingMipmapsMaxFileIORequests: 1024
    particleRaycastBudget: 64
    asyncUploadTimeSlice: 2
    asyncUploadBufferSize: 16
    asyncUploadPersistentBuffer: 1
    resolutionScalingFixedDPIFactor: 1
    excludedTargetPlatforms: []
  - serializedVersion: 2
    name: High
    pixelLightCount: 2
    shadows: 2
    shadowResolution: 1
    shadowProjection: 1
    shadowCascades: 2
    shadowDistance: 40
    shadowNearPlaneOffset: 3
    shadowCascade2Split: 0.33333334
    shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
    shadowmaskMode: 1
    skinWeights: 2
    textureQuality: 0
    anisotropicTextures: 1
    antiAliasing: 4
    softParticles: 0
    softVegetation: 1
    realtimeReflectionProbes: 1
    billboardsFaceCameraPosition: 1
    vSyncCount: 1
    lodBias: 1
    maximumLODLevel: 0
    streamingMipmapsActive: 0
    streamingMipmapsAddAllCameras: 1
    streamingMipmapsMemoryBudget: 512
    streamingMipmapsRenderersPerFrame: 512
    streamingMipmapsMaxLevelReduction: 2
    streamingMipmapsMaxFileIORequests: 1024
    particleRaycastBudget: 256
    asyncUploadTimeSlice: 2
    asyncUploadBufferSize: 16
    asyncUploadPersistentBuffer: 1
    resolutionScalingFixedDPIFactor: 1
    excludedTargetPlatforms: []
  - serializedVersion: 2
    name: Very High
    pixelLightCount: 3
    shadows: 2
    shadowResolution: 2
    shadowProjection: 1
    shadowCascades: 2
    shadowDistance: 70
    shadowNearPlaneOffset: 3
    shadowCascade2Split: 0.33333334
    shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
    shadowmaskMode: 1
    skinWeights: 4
    textureQuality: 0
    anisotropicTextures: 1
    antiAliasing: 0
    softParticles: 1
    softVegetation: 1
    realtimeReflectionProbes: 1
    billboardsFaceCameraPosition: 1
    vSyncCount: 1
    lodBias: 1.5
    maximumLODLevel: 0
    streamingMipmapsActive: 0
    streamingMipmapsAddAllCameras: 1
    streamingMipmapsMemoryBudget: 512
    streamingMipmapsRenderersPerFrame: 512
    streamingMipmapsMaxLevelReduction: 2
    streamingMipmapsMaxFileIORequests: 1024
    particleRaycastBudget: 1024
    asyncUploadTimeSlice: 2
    asyncUploadBufferSize: 16
    asyncUploadPersistentBuffer: 1
    resolutionScalingFixedDPIFactor: 1
    excludedTargetPlatforms: []
  - serializedVersion: 2
    name: Ultra
    pixelLightCount: 4
    shadows: 2
    shadowResolution: 2
    shadowProjection: 1
    shadowCascades: 4
    shadowDistance: 150
    shadowNearPlaneOffset: 3
    shadowCascade2Split: 0.33333334
    shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
    shadowmaskMode: 1
    skinWeights: 4
    textureQuality: 0
    anisotropicTextures: 1
    antiAliasing: 0
    softParticles: 1
    softVegetation: 1
    realtimeReflectionProbes: 1
    billboardsFaceCameraPosition: 1
    vSyncCount: 1
    lodBias: 2
    maximumLODLevel: 0
    streamingMipmapsActive: 0
    streamingMipmapsAddAllCameras: 1
    streamingMipmapsMemoryBudget: 512
    streamingMipmapsRenderersPerFrame: 512
    streamingMipmapsMaxLevelReduction: 2
    streamingMipmapsMaxFileIORequests: 1024
    particleRaycastBudget: 4096
    asyncUploadTimeSlice: 2
    asyncUploadBufferSize: 16
    asyncUploadPersistentBuffer: 1
    resolutionScalingFixedDPIFactor: 1
    excludedTargetPlatforms: []
  m_PerPlatformDefaultQuality:
    Android: 2
    Nintendo 3DS: 5
    Nintendo Switch: 5
    PS4: 5
    PSP2: 2
    Standalone: 5
    Tizen: 2
    WebGL: 3
    WiiU: 5
    Windows Store Apps: 5
    XboxOne: 5
    iPhone: 2
    tvOS: 2


code:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!78 &1
TagManager:
  serializedVersion: 2
  tags: []
  layers:
  - Default
  - TransparentFX
  - Ignore Raycast
  -
  - Water
  - UI
  -
  -
  - PostProcessing
  -
  -
  -
  -
  -
  -
  -
  -
  -
  -
  -
  -
  -
  -
  -
  -
  -
  -
  -
  -
  -
  -
  -
  m_SortingLayers:
  - name: Default
    uniqueID: 0
    locked: 0


code:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!5 &1
TimeManager:
  m_ObjectHideFlags: 0
  Fixed Timestep: 0.02
  Maximum Allowed Timestep: 0.1
  m_TimeScale: 1
  Maximum Particle Timestep: 0.03


code:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!310 &1
UnityConnectSettings:
  m_ObjectHideFlags: 0
  serializedVersion: 1
  m_Enabled: 0
  m_TestMode: 0
  m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events
  m_EventUrl: https://cdp.cloud.unity3d.com/v1/events
  m_ConfigUrl: https://config.uca.cloud.unity3d.com
  m_TestInitMode: 0
  CrashReportingSettings:
    m_EventUrl: https://perf-events.cloud.unity3d.com
    m_Enabled: 0
    m_LogBufferSize: 10
    m_CaptureEditorExceptions: 1
  UnityPurchasingSettings:
    m_Enabled: 0
    m_TestMode: 0
  UnityAnalyticsSettings:
    m_Enabled: 0
    m_TestMode: 0
    m_InitializeOnStartup: 1
  UnityAdsSettings:
    m_Enabled: 0
    m_InitializeOnStartup: 1
    m_TestMode: 0
    m_IosGameId:
    m_AndroidGameId:
    m_GameIds: {}
    m_GameId:
  PerformanceReportingSettings:
    m_Enabled: 0


code:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!937362698 &1
VFXManager:
  m_ObjectHideFlags: 0
  m_IndirectShader: {fileID: 0}
  m_CopyBufferShader: {fileID: 0}
  m_SortShader: {fileID: 0}
  m_RenderPipeSettingsPath:
  m_FixedTimeStep: 0.016666668
  m_MaxDeltaTime: 0.05


m_SettingKeys:
VR Device Disabled
VR Device User Alert

m_SettingValues: False False


code:
/INSTALL
/Makefile
/Makefile.in
/aclocal.m4
/autom4te.cache
/build-aux
/config.log
/config.status
/configure
/env
*.go

repo_name: jonsger/guile

path: .gitignore

license: mit


code: Andy Wingo <wingo@pobox.com>

path: AUTHORS


code:
include build-aux/guile.am

moddir=$(prefix)/share/guile/site/$(GUILE_EFFECTIVE_VERSION)
godir=$(libdir)/guile/$(GUILE_EFFECTIVE_VERSION)/ccache

SOURCES =					\
	sqlite3.scm

TESTS = 					\
	tests/basic.test
TEST_LOG_COMPILER = $(abs_top_builddir)/env $(GUILE) --no-auto-compile

EXTRA_DIST += $(TESTS)


code:
# guile-sqlite3

This is the repository of guile bindings for sqlite3
@ [notabug.org](https://notabug.org/civodul/guile-sqlite3):

```bash
git clone https://notabug.org/civodul/guile-sqlite3.git
```

## Documentation

At the moment there is only the source code.

## Building

To build guile-sqlite3 you need `guile` and `autotools`.

Then just do:

```bash
autoreconf -vfi
./configure
make
```

## Testing

To run the test suite just do:

```bash
make check
```

Eventually you have to point `LD_LIBRARY_PATH` to the directory of the `libsqlite3.so` file.

## Installing

### Guix

`guix package -i guile-sqlite3`

### openSUSE

`sudo zypper install guile-sqlite3`

path: README


code:
## Autoconf macros for working with Guile.
##
##   Copyright (C) 1998,2001, 2006, 2010, 2012 Free Software Foundation, Inc.
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public License
## as published by the Free Software Foundation; either version 3 of
## the License, or (at your option) any later version.
##
## This library is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
## Lesser General Public License for more details.
##
## You should have received a copy of the GNU Lesser General Public
## License along with this library; if not, write to the Free Software
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
## 02110-1301 USA

# serial 10

## Index
## -----
##
## GUILE_PKG -- find Guile development files
## GUILE_PROGS -- set paths to Guile interpreter, config and tool programs
## GUILE_FLAGS -- set flags for compiling and linking with Guile
## GUILE_SITE_DIR -- find path to Guile "site" directory
## GUILE_CHECK -- evaluate Guile Scheme code and capture the return value
## GUILE_MODULE_CHECK -- check feature of a Guile Scheme module
## GUILE_MODULE_AVAILABLE -- check availability of a Guile Scheme module
## GUILE_MODULE_REQUIRED -- fail if a Guile Scheme module is unavailable
## GUILE_MODULE_EXPORTS -- check if a module exports a variable
## GUILE_MODULE_REQUIRED_EXPORT -- fail if a module doesn't export a variable

## Code
## ----

## NOTE: Comments preceding an AC_DEFUN (starting from "Usage:") are massaged
## into doc/ref/autoconf-macros.texi (see Makefile.am in that directory).

# GUILE_PKG -- find Guile development files
#
# Usage: GUILE_PKG([VERSIONS])
#
# This macro runs the @code{pkg-config} tool to find development files
# for an available version of Guile.
#
# By default, this macro will search for the latest stable version of
# Guile (e.g. 2.0), falling back to the previous stable version
# (e.g. 1.8) if it is available.  If no guile-@var{VERSION}.pc file is
# found, an error is signalled.  The found version is stored in
# @var{GUILE_EFFECTIVE_VERSION}.
#
# If @code{GUILE_PROGS} was already invoked, this macro ensures that the
# development files have the same effective version as the Guile
# program.
#
# @var{GUILE_EFFECTIVE_VERSION} is marked for substitution, as by
# @code{AC_SUBST}.
#
AC_DEFUN([GUILE_PKG],
 [PKG_PROG_PKG_CONFIG
  _guile_versions_to_search="m4_default([$1], [2.0 1.8])"
  if test -n "$GUILE_EFFECTIVE_VERSION"; then
    _guile_tmp=""
    for v in $_guile_versions_to_search; do
      if test "$v" = "$GUILE_EFFECTIVE_VERSION"; then
        _guile_tmp=$v
      fi
    done
    if test -z "$_guile_tmp"; then
      AC_MSG_FAILURE([searching for guile development files for versions $_guile_versions_to_search, but previously found $GUILE version $GUILE_EFFECTIVE_VERSION])
    fi
    _guile_versions_to_search=$GUILE_EFFECTIVE_VERSION
  fi
  GUILE_EFFECTIVE_VERSION=""
  _guile_errors=""
  for v in $_guile_versions_to_search; do
    AC_MSG_NOTICE([checking for guile $v])
    if test -z "$GUILE_EFFECTIVE_VERSION"; then
      PKG_CHECK_EXISTS([guile-$v], [GUILE_EFFECTIVE_VERSION=$v], [])
    fi
  done

  if test -z "$GUILE_EFFECTIVE_VERSION"; then
    AC_MSG_ERROR([
No Guile development packages were found.

Please verify that you have Guile installed.  If you installed Guile
from a binary distribution, please verify that you have also installed
the development packages.  If you installed it yourself, you might need
to adjust your PKG_CONFIG_PATH; see the pkg-config man page for more.
])
  fi
  AC_MSG_NOTICE([found guile $v])
  AC_SUBST([GUILE_EFFECTIVE_VERSION])
 ])

# GUILE_FLAGS -- set flags for compiling and linking with Guile
#
# Usage: GUILE_FLAGS
#
# This macro runs the @code{pkg-config} tool to find out how to compile
# and link programs against Guile.  It sets four variables:
# @var{GUILE_CFLAGS}, @var{GUILE_LDFLAGS}, @var{GUILE_LIBS}, and
# @var{GUILE_LTLIBS}.
#
# @var{GUILE_CFLAGS}: flags to pass to a C or C++ compiler to build code that
# uses Guile header files.  This is almost always just one or more @code{-I}
# flags.
#
# @var{GUILE_LDFLAGS}: flags to pass to the compiler to link a program
# against Guile.  This includes @code{-lguile-@var{VERSION}} for the
# Guile library itself, and may also include one or more @code{-L} flag
# to tell the compiler where to find the libraries.  But it does not
# include flags that influence the program's runtime search path for
# libraries, and will therefore lead to a program that fails to start,
# unless all necessary libraries are installed in a standard location
# such as @file{/usr/lib}.
#
# @var{GUILE_LIBS} and @var{GUILE_LTLIBS}: flags to pass to the compiler or to
# libtool, respectively, to link a program against Guile.  It includes flags
# that augment the program's runtime search path for libraries, so that shared
# libraries will be found at the location where they were during linking, even
# in non-standard locations.  @var{GUILE_LIBS} is to be used when linking the
# program directly with the compiler, whereas @var{GUILE_LTLIBS} is to be used
# when linking the program is done through libtool.
#
# The variables are marked for substitution, as by @code{AC_SUBST}.
#
AC_DEFUN([GUILE_FLAGS],
 [AC_REQUIRE([GUILE_PKG])
  PKG_CHECK_MODULES(GUILE, [guile-$GUILE_EFFECTIVE_VERSION])

  dnl GUILE_CFLAGS and GUILE_LIBS are already defined and AC_SUBST'd by
  dnl PKG_CHECK_MODULES.  But GUILE_LIBS to pkg-config is GUILE_LDFLAGS
  dnl to us.

  GUILE_LDFLAGS=$GUILE_LIBS

  dnl Determine the platform dependent parameters needed to use rpath.
  dnl AC_LIB_LINKFLAGS_FROM_LIBS is defined in gnulib/m4/lib-link.m4 and needs
  dnl the file gnulib/build-aux/config.rpath.
  AC_LIB_LINKFLAGS_FROM_LIBS([GUILE_LIBS], [$GUILE_LDFLAGS], [])
  GUILE_LIBS="$GUILE_LDFLAGS $GUILE_LIBS"
  AC_LIB_LINKFLAGS_FROM_LIBS([GUILE_LTLIBS], [$GUILE_LDFLAGS], [yes])
  GUILE_LTLIBS="$GUILE_LDFLAGS $GUILE_LTLIBS"

  AC_SUBST([GUILE_EFFECTIVE_VERSION])
  AC_SUBST([GUILE_CFLAGS])
  AC_SUBST([GUILE_LDFLAGS])
  AC_SUBST([GUILE_LIBS])
  AC_SUBST([GUILE_LTLIBS])
 ])

# GUILE_SITE_DIR -- find path to Guile "site" directory
#
# Usage: GUILE_SITE_DIR
#
# This looks for Guile's "site" directory, usually something like
# PREFIX/share/guile/site, and sets var @var{GUILE_SITE} to the path.
# Note that the var name is different from the macro name.
#
# The variable is marked for substitution, as by @code{AC_SUBST}.
#
AC_DEFUN([GUILE_SITE_DIR],
 [AC_REQUIRE([GUILE_PKG])
  AC_MSG_CHECKING(for Guile site directory)
  GUILE_SITE=`$PKG_CONFIG --print-errors --variable=sitedir guile-$GUILE_EFFECTIVE_VERSION`
  AC_MSG_RESULT($GUILE_SITE)
  if test "$GUILE_SITE" = ""; then
     AC_MSG_FAILURE(sitedir not found)
  fi
  AC_SUBST(GUILE_SITE)
 ])

# GUILE_PROGS -- set paths to Guile interpreter, config and tool programs
#
# Usage: GUILE_PROGS
#
# This macro looks for programs @code{guile} and @code{guild}, setting
# variables @var{GUILE} and @var{GUILD} to their paths, respectively.
# If @code{guile} is not found, signal an error.
#
# The effective version of the found @code{guile} is set to
# @var{GUILE_EFFECTIVE_VERSION}.  This macro ensures that the effective
# version is compatible with the result of a previous invocation of
# @code{GUILE_FLAGS}, if any.
#
# As a legacy interface, it also looks for @code{guile-config} and
# @code{guile-tools}, setting @var{GUILE_CONFIG} and @var{GUILE_TOOLS}.
#
# The variables are marked for substitution, as by @code{AC_SUBST}.
#
AC_DEFUN([GUILE_PROGS],
 [AC_PATH_PROG(GUILE,guile)
  if test "$GUILE" = "" ; then
      AC_MSG_ERROR([guile required but not found])
  fi
  AC_SUBST(GUILE)

  _guile_prog_version=`$GUILE -c "(display (effective-version))"`
  if test -z "$GUILE_EFFECTIVE_VERSION"; then
    GUILE_EFFECTIVE_VERSION=$_guile_prog_version
  elif test "$GUILE_EFFECTIVE_VERSION" != "$_guile_prog_version"; then
    AC_MSG_ERROR([found development files for Guile $GUILE_EFFECTIVE_VERSION, but $GUILE has effective version $_guile_prog_version])
  fi

  AC_PATH_PROG(GUILD,guild)
  AC_SUBST(GUILD)

  AC_PATH_PROG(GUILE_CONFIG,guile-config)
  AC_SUBST(GUILE_CONFIG)
  if test -n "$GUILD"; then
    GUILE_TOOLS=$GUILD
  else
    AC_PATH_PROG(GUILE_TOOLS,guile-tools)
  fi
  AC_SUBST(GUILE_TOOLS)
 ])

# GUILE_CHECK -- evaluate Guile Scheme code and capture the return value
#
# Usage: GUILE_CHECK_RETVAL(var,check)
#
# @var{var} is a shell variable name to be set to the return value.
# @var{check} is a Guile Scheme expression, evaluated with "$GUILE -c", and
#    returning either 0 or non-#f to indicate the check passed.
#    Non-0 number or #f indicates failure.
#    Avoid using the character "#" since that confuses autoconf.
#
AC_DEFUN([GUILE_CHECK],
 [AC_REQUIRE([GUILE_PROGS])
  $GUILE -c "$2" > /dev/null 2>&1
  $1=$?
 ])

# GUILE_MODULE_CHECK -- check feature of a Guile Scheme module
#
# Usage: GUILE_MODULE_CHECK(var,module,featuretest,description)
#
# @var{var} is a shell variable name to be set to "yes" or "no".
# @var{module} is a list of symbols, like: (ice-9 common-list).
# @var{featuretest} is an expression acceptable to GUILE_CHECK, q.v.
# @var{description} is a present-tense verb phrase (passed to AC_MSG_CHECKING).
#
AC_DEFUN([GUILE_MODULE_CHECK],
         [AC_MSG_CHECKING([if $2 $4])
	  GUILE_CHECK($1,(use-modules $2) (exit ((lambda () $3))))
	  if test "$$1" = "0" ; then $1=yes ; else $1=no ; fi
          AC_MSG_RESULT($$1)
         ])

# GUILE_MODULE_AVAILABLE -- check availability of a Guile Scheme module
#
# Usage: GUILE_MODULE_AVAILABLE(var,module)
#
# @var{var} is a shell variable name to be set to "yes" or "no".
# @var{module} is a list of symbols, like: (ice-9 common-list).
#
AC_DEFUN([GUILE_MODULE_AVAILABLE],
         [GUILE_MODULE_CHECK($1,$2,0,is available)
         ])

# GUILE_MODULE_REQUIRED -- fail if a Guile Scheme module is unavailable
#
# Usage: GUILE_MODULE_REQUIRED(symlist)
#
# @var{symlist} is a list of symbols, WITHOUT surrounding parens,
# like: ice-9 common-list.
#
AC_DEFUN([GUILE_MODULE_REQUIRED],
         [GUILE_MODULE_AVAILABLE(ac_guile_module_required, ($1))
          if test "$ac_guile_module_required" = "no" ; then
              AC_MSG_ERROR([required guile module not found: ($1)])
          fi
         ])

# GUILE_MODULE_EXPORTS -- check if a module exports a variable
#
# Usage: GUILE_MODULE_EXPORTS(var,module,modvar)
#
# @var{var} is a shell variable to be set to "yes" or "no".
# @var{module} is a list of symbols, like: (ice-9 common-list).
# @var{modvar} is the Guile Scheme variable to check.
#
AC_DEFUN([GUILE_MODULE_EXPORTS],
 [GUILE_MODULE_CHECK($1,$2,$3,exports `$3')
 ])

# GUILE_MODULE_REQUIRED_EXPORT -- fail if a module doesn't export a variable
#
# Usage: GUILE_MODULE_REQUIRED_EXPORT(module,modvar)
#
# @var{module} is a list of symbols, like: (ice-9 common-list).
# @var{modvar} is the Guile Scheme variable to check.
#
AC_DEFUN([GUILE_MODULE_REQUIRED_EXPORT],
 [GUILE_MODULE_EXPORTS(guile_module_required_export,$1,$2)
  if test "$guile_module_required_export" = "no" ; then
      AC_MSG_ERROR([module $1 does not export $2; required])
  fi
 ])

## guile.m4 ends here


code:
GOBJECTS = $(SOURCES:%.scm=%.go)

nobase_mod_DATA = $(SOURCES) $(NOCOMP_SOURCES)
nobase_go_DATA = $(GOBJECTS)

# Make sure source files are installed first, so that the mtime of
# installed compiled files is greater than that of installed source
# files.  See
# <http://lists.gnu.org/archive/html/guile-devel/2010-07/msg00125.html>
# for details.
guile_install_go_files = install-nobase_goDATA
$(guile_install_go_files): install-nobase_modDATA

CLEANFILES = $(GOBJECTS)
EXTRA_DIST = $(SOURCES) $(NOCOMP_SOURCES)
GUILE_WARNINGS = -Wunbound-variable -Warity-mismatch -Wformat
SUFFIXES = .scm .go
.scm.go:
	$(AM_V_GEN)$(top_builddir)/env $(GUILE_TOOLS) compile $(GUILE_WARNINGS) -o "$@" "$<"


code:
dnl -*- Autoconf -*-

AC_INIT(sqlite3, 0.1.0)
AC_CONFIG_SRCDIR(sqlite3.scm)
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([color-tests -Wall -Wno-portability])
AM_SILENT_RULES([yes])

GUILE_PROGS([2.2 2.0])
AC_SUBST([GUILE_EFFECTIVE_VERSION])

AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([env], [chmod +x env])

AC_OUTPUT


code:
#!/bin/sh

if test -z "$GUILE_LOAD_PATH"; then
  export GUILE_LOAD_PATH="@abs_top_srcdir@"
else
  export GUILE_LOAD_PATH="@abs_top_srcdir@":$GUILE_LOAD_PATH
fi

if test -z "$GUILE_LOAD_COMPILED_PATH"; then
  export GUILE_LOAD_COMPILED_PATH="@abs_top_builddir@"
else
  export GUILE_LOAD_COMPILED_PATH="@abs_top_builddir@":$GUILE_LOAD_COMPILED_PATH
fi

exec "$@"


code:
;; Guile-SQLite3
;; Copyright (C) 2010, 2014 Andy Wingo <wingo at pobox dot com>
;; Copyright (C) 2018 Ludovic Courtès <ludo@gnu.org>

;; This library is free software; you can redistribute it and/or modify
;; it under the terms of the GNU Lesser General Public License as
;; published by the Free Software Foundation; either version 3 of the
;; License, or (at your option) any later version.
;;
;; This library is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
;; Lesser General Public License for more details.
;;
;; You should have received a copy of the GNU Lesser General Public
;; License along with this program; if not, contact:
;;
;; Free Software Foundation           Voice:  +1-617-542-5942
;; 59 Temple Place - Suite 330        Fax:    +1-617-542-2652
;; Boston, MA  02111-1307,  USA       gnu@gnu.org

;;; Commentary:
;;
;; A Guile binding for sqlite.
;;
;;; Code:

(define-module (sqlite3)
  #:use-module (system foreign)
  #:use-module (rnrs bytevectors)
  #:use-module (ice-9 match)
  #:use-module (srfi srfi-1)
  #:use-module (srfi srfi-9)
  #:use-module (srfi srfi-19)
  #:export (sqlite-open
            sqlite-close

	    sqlite-enable-load-extension
            sqlite-exec
            sqlite-prepare
            sqlite-bind
            sqlite-bind-arguments
            sqlite-column-names
            sqlite-step
            sqlite-fold
            sqlite-fold-right
            sqlite-map
            sqlite-reset
            sqlite-finalize
            sqlite-bind-parameter-index
            sqlite-busy-timeout

            SQLITE_OPEN_READONLY
            SQLITE_OPEN_READWRITE
            SQLITE_OPEN_CREATE
            SQLITE_OPEN_DELETEONCLOSE
            SQLITE_OPEN_EXCLUSIVE
            SQLITE_OPEN_MAIN_DB
            SQLITE_OPEN_TEMP_DB
            SQLITE_OPEN_TRANSIENT_DB
            SQLITE_OPEN_MAIN_JOURNAL
            SQLITE_OPEN_TEMP_JOURNAL
            SQLITE_OPEN_SUBJOURNAL
            SQLITE_OPEN_MASTER_JOURNAL
            SQLITE_OPEN_NOMUTEX
            SQLITE_OPEN_FULLMUTEX
            SQLITE_OPEN_SHAREDCACHE
            SQLITE_OPEN_PRIVATECACHE

            SQLITE_CONSTRAINT
            SQLITE_CONSTRAINT_PRIMARYKEY
            SQLITE_CONSTRAINT_UNIQUE))

;;
;; Utils
;;
(define (string->utf8-pointer s)
  (string->pointer s "utf-8"))

(define (utf8-pointer->string p)
  (pointer->string p -1 "utf-8"))

;;
;; Constants
;;

;; FIXME: snarf using compiler. These are just copied from the header...
;;
(define SQLITE_OPEN_READONLY         #x00000001) ;; Ok for sqlite3_open_v2()
(define SQLITE_OPEN_READWRITE        #x00000002) ;; Ok for sqlite3_open_v2()
(define SQLITE_OPEN_CREATE           #x00000004) ;; Ok for sqlite3_open_v2()
(define SQLITE_OPEN_DELETEONCLOSE    #x00000008) ;; VFS only
(define SQLITE_OPEN_EXCLUSIVE        #x00000010) ;; VFS only
(define SQLITE_OPEN_MAIN_DB          #x00000100) ;; VFS only
(define SQLITE_OPEN_TEMP_DB          #x00000200) ;; VFS only
(define SQLITE_OPEN_TRANSIENT_DB     #x00000400) ;; VFS only
(define SQLITE_OPEN_MAIN_JOURNAL     #x00000800) ;; VFS only
(define SQLITE_OPEN_TEMP_JOURNAL     #x00001000) ;; VFS only
(define SQLITE_OPEN_SUBJOURNAL       #x00002000) ;; VFS only
(define SQLITE_OPEN_MASTER_JOURNAL   #x00004000) ;; VFS only
(define SQLITE_OPEN_NOMUTEX          #x00008000) ;; Ok for sqlite3_open_v2()
(define SQLITE_OPEN_FULLMUTEX        #x00010000) ;; Ok for sqlite3_open_v2()
(define SQLITE_OPEN_SHAREDCACHE      #x00020000) ;; Ok for sqlite3_open_v2()
(define SQLITE_OPEN_PRIVATECACHE     #x00040000) ;; Ok for sqlite3_open_v2()

(define SQLITE_CONSTRAINT 19)
(define SQLITE_CONSTRAINT_PRIMARYKEY
  (logior SQLITE_CONSTRAINT (ash 6 8)))
(define SQLITE_CONSTRAINT_UNIQUE
  (logior SQLITE_CONSTRAINT (ash 8 8)))

(define libsqlite3 (dynamic-link "libsqlite3"))

(define-record-type <sqlite-db>
  (make-db pointer open? stmts)
  db?
  (pointer db-pointer)
  (open? db-open? set-db-open?!)
  (stmts db-stmts))

(define-record-type <sqlite-stmt>
  (make-stmt pointer live? reset? cached?)
  stmt?
  (pointer stmt-pointer)
  (live? stmt-live? set-stmt-live?!)
  (reset? stmt-reset? set-stmt-reset?!)
  (cached? stmt-cached? set-stmt-cached?!))

(define sqlite-errmsg
  (let ((f (pointer->procedure
            '*
            (dynamic-func "sqlite3_errmsg" libsqlite3)
            (list '*))))
    (lambda (db)
      (utf8-pointer->string (f (db-pointer db))))))

(define sqlite-errcode
  (let ((f (pointer->procedure
            int
            (dynamic-func "sqlite3_extended_errcode" libsqlite3)
            (list '*))))
    (lambda (db)
      (f (db-pointer db)))))

(define* (sqlite-error db who #:optional code
                       (errmsg (and db (sqlite-errmsg db))))
  (throw 'sqlite-error who code errmsg))

(define* (check-error db #:optional who)
  (let ((code (sqlite-errcode db)))
    (if (not (zero? code))
        (sqlite-error db who code))))

(define sqlite-close
  (let ((f (pointer->procedure
            int
            (dynamic-func "sqlite3_close" libsqlite3)
            (list '*))))
    (lambda (db)
      (when (db-open? db)
        ;; Finalize cached statements.
        (hash-for-each (lambda (sql stmt)
                         (set-stmt-cached?! stmt #f)
                         (sqlite-finalize stmt))
                       (db-stmts db))
        (hash-clear! (db-stmts db))

        (let ((p (db-pointer db)))
          (set-db-open?! db #f)
          (f p))))))

(define db-guardian (make-guardian))
(define (pump-db-guardian)
  (let ((db (db-guardian)))
    (if db
        (begin
          (sqlite-close db)
          (pump-db-guardian)))))
(add-hook! after-gc-hook pump-db-guardian)

(define (static-errcode->errmsg code)
  (case code
    ((1) "SQL error or missing database")
    ((2) "Internal logic error in SQLite")
    ((3) "Access permission denied")
    ((5) "The database file is locked")
    ((6) "A table in the database is locked")
    ((7) "A malloc() failed")
    ((8) "Attempt to write a readonly database")
    ((10) "Some kind of disk I/O error occurred")
    ((11) "The database disk image is malformed")
    ((14) "Unable to open the database file")
    ((21) "Library used incorrectly")
    ((22) "Uses OS features not supported on host")
    ((23) "Authorization denied")
    ((24) "Auxiliary database format error")
    ((26) "File opened that is not a database file")
    (else "Unknown error")))

(define sqlite-open
  (let ((f (pointer->procedure
            int
            (dynamic-func "sqlite3_open_v2" libsqlite3)
            (list '* '* int '*))))
    (lambda* (filename #:optional
                       (flags (logior SQLITE_OPEN_READWRITE SQLITE_OPEN_CREATE))
                       (vfs #f))
      (let* ((out-db (bytevector->pointer (make-bytevector (sizeof '*) 0)))
             (ret (f (string->utf8-pointer filename)
                     out-db
                     flags
                     (if vfs (string->utf8-pointer vfs) %null-pointer))))
        (if (zero? ret)
            (let ((db (make-db (dereference-pointer out-db) #t
                               (make-hash-table))))
              (db-guardian db)
              db)
            (sqlite-error #f 'sqlite-open ret (static-errcode->errmsg ret)))))))

(define sqlite-enable-load-extension
  (let ((ele (pointer->procedure
	      int
	      (dynamic-func "sqlite3_enable_load_extension" libsqlite3)
	      (list '* int))))
    (lambda (db onoff)
      (ele (db-pointer db) onoff))))

(define sqlite-exec
  (let ((exec (pointer->procedure
               int
               (dynamic-func "sqlite3_exec" (@@ (sqlite3) libsqlite3))
               '(* * * * *))))
    (lambda* (db sql)
      "Evaluate the string SQL, which may contain one or several SQL
statements, into DB.  The result is unspecified."
      ;; XXX: 'sqlite3_exec' has a 'callback' parameter but we ignore it
      ;; here.
      (assert-live-db! db)
      (unless (zero? (exec (db-pointer db) (string->pointer sql)
                           %null-pointer %null-pointer %null-pointer))
        (check-error db 'sqlite-exec)))))

;;;
;;; SQL statements
;;;

(define sqlite-remove-statement!
  (lambda (db stmt)
    (when (stmt-cached? stmt)
      (let* ((stmts (db-stmts db))
             (key   (catch 'value
                      (lambda ()
                        (hash-for-each (lambda (key value)
                                         (when (eq? value stmt)
                                           (throw 'value key)))
                                       stmts)
                        #f)
                      (lambda (_ key) key))))
        (hash-remove! stmts key)))))

(define sqlite-finalize
  (let ((f (pointer->procedure
            int
            (dynamic-func "sqlite3_finalize" libsqlite3)
            (list '*))))
    (lambda (stmt)
      ;; Note: When STMT is cached, this is a no-op.  This ensures caching
      ;; actually works while still separating concerns: users can turn
      ;; caching on and off without having to change the rest of their code.
      (when (and (stmt-live? stmt)
                 (not (stmt-cached? stmt)))
        (let ((p (stmt-pointer stmt)))
          (sqlite-remove-statement! (stmt->db stmt) stmt)
          (set-stmt-live?! stmt #f)
          (f p))))))

(define *stmt-map* (make-weak-key-hash-table))
(define (stmt->db stmt)
  (hashq-ref *stmt-map* stmt))

(define stmt-guardian (make-guardian))
(define (pump-stmt-guardian)
  (let ((stmt (stmt-guardian)))
    (if stmt
        (begin
          (sqlite-finalize stmt)
          (pump-stmt-guardian)))))
(add-hook! after-gc-hook pump-stmt-guardian)

(define sqlite-reset
  (let ((reset (pointer->procedure
                int
                (dynamic-func "sqlite3_reset" libsqlite3)
                (list '*))))
    (lambda (stmt)
      (if (stmt-live? stmt)
          (let ((p (stmt-pointer stmt)))
            (set-stmt-reset?! stmt #t)
            (reset p))
          (error "statement already finalized" stmt)))))

(define (assert-live-stmt! stmt)
  (if (not (stmt-live? stmt))
      (error "statement already finalized" stmt)))

(define (assert-live-db! db)
  (if (not (db-open? db))
      (error "database already closed" db)))

(define %sqlite-prepare
  (let ((prepare (pointer->procedure
                  int
                  (dynamic-func "sqlite3_prepare_v2" libsqlite3)
                  (list '* '* int '* '*))))
    (lambda* (db sql #:key cache?)
      (assert-live-db! db)
      (let* ((out-stmt (bytevector->pointer (make-bytevector (sizeof '*) 0)))
             (out-tail (bytevector->pointer (make-bytevector (sizeof '*) 0)))
             (bv (string->utf8 sql))
             (bvp (bytevector->pointer bv))
             (ret (prepare (db-pointer db)
                           bvp
                           (bytevector-length bv)
                           out-stmt
                           out-tail)))
        (if (zero? ret)
            (if (= (bytevector-length bv)
                   (- (pointer-address (dereference-pointer out-tail))
                      (pointer-address bvp)))
                (let ((stmt (make-stmt (dereference-pointer out-stmt) #t #t
                                       cache?)))
                  (stmt-guardian stmt)
                  (hashq-set! *stmt-map* stmt db)
                  stmt)
                (error "input sql has useless tail"
                       (utf8-pointer->string
                        (dereference-pointer out-tail))))
            (check-error db 'sqlite-prepare))))))

(define* (sqlite-prepare db sql #:key cache?)
  (if cache?
      (match (hash-ref (db-stmts db) sql)
        (#f
         (let ((stmt (%sqlite-prepare db sql #:cache? #t)))
           (hash-set! (db-stmts db) sql stmt)
           stmt))
        (stmt
         (sqlite-reset stmt)
         stmt))
      (%sqlite-prepare db sql)))

(define sqlite-bind-parameter-index
  (let ((bind-parameter-index (pointer->procedure
                  int
                  (dynamic-func "sqlite3_bind_parameter_index" libsqlite3)
                  (list '* '*))))
    (lambda (stmt name)
      (assert-live-stmt! stmt)
      (let* ((ret (bind-parameter-index (stmt-pointer stmt)
                                        (string->utf8-pointer name))))
        (if (> ret 0)
            ret
            (begin
              (check-error (stmt->db stmt) 'sqlite-bind-parameter-index)
              (write ret)
              (newline)
              (error "No such parameter" name)))))))

(define key->index
  (lambda (stmt key)
    (cond
     ((string? key) (sqlite-bind-parameter-index stmt key))
     ((symbol? key) (sqlite-bind-parameter-index stmt
                     (string-append ":" (symbol->string key))))
     (else key))))

(define sqlite-bind
  (let ((bind-blob (pointer->procedure
                    int
                    (dynamic-func "sqlite3_bind_blob" libsqlite3)
                    (list '* int '* int '*)))
        (bind-text (pointer->procedure
                    int
                    (dynamic-func "sqlite3_bind_text" libsqlite3)
                    (list '* int '* int '*)))
        (bind-int64 (pointer->procedure
                     int
                     (dynamic-func "sqlite3_bind_int64" libsqlite3)
                     (list '* int int64)))
        (bind-double (pointer->procedure
                      int
                      (dynamic-func "sqlite3_bind_double" libsqlite3)
                      (list '* int double)))
        (bind-null (pointer->procedure
                    int
                    (dynamic-func "sqlite3_bind_null" libsqlite3)
                    (list '* int)))
        (sqlite-transient (make-pointer
                           (bit-extract (lognot 0) 0 (* 8 (sizeof '*))))))
    (lambda (stmt key val)
      (assert-live-stmt! stmt)
      (let ((idx (key->index stmt key))
            (p (stmt-pointer stmt)))
        (cond
         ((bytevector? val)
          (bind-blob p idx (bytevector->pointer val) (bytevector-length val)
                     sqlite-transient))
         ((string? val)
          (let ((bv (string->utf8 val)))
            (bind-text p idx (bytevector->pointer bv) (bytevector-length bv)
                       sqlite-transient)))
         ((and (integer? val) (exact? val))
          (bind-int64 p idx val))
         ((number? val)
          (bind-double p idx (exact->inexact val)))
         ((not val)
          (bind-null p idx))
         (else
          (error "unexpected value" val)))
        (check-error (stmt->db stmt))))))

(define (sqlite-bind-arguments stmt . args)
  "Bind STMT parameters, one after another, to ARGS.
Also bind named parameters to the respective ones."
  (let loop ((i 1)
             (args args))
    (match args
      (()
       #f)
      (((? keyword? kw) value . rest)
       (sqlite-bind stmt (keyword->symbol kw) value)
       (loop i rest))
      ((arg . rest)
       (sqlite-bind stmt i arg)
       (loop (+ 1 i) rest)))))

(define sqlite-column-count
  (let ((column-count
         (pointer->procedure
          int
          (dynamic-pointer "sqlite3_column_count" libsqlite3)
          (list '*))))
    (lambda (stmt)
      (assert-live-stmt! stmt)
      (column-count (stmt-pointer stmt)))))

(define sqlite-column-name
  (let ((column-name
         (pointer->procedure
          '*
          (dynamic-pointer "sqlite3_column_name" libsqlite3)
          (list '* int))))
    (lambda (stmt i)
      (assert-live-stmt! stmt)
      (utf8-pointer->string (column-name (stmt-pointer stmt) i)))))

(define sqlite-column-value
  (let ((value-type
         (pointer->procedure
          int
          (dynamic-pointer "sqlite3_column_type" libsqlite3)
          (list '* int)))
        (value-int
         (pointer->procedure
          int64
          (dynamic-pointer "sqlite3_column_int64" libsqlite3)
          (list '* int)))
        (value-double
         (pointer->procedure
          double
          (dynamic-pointer "sqlite3_column_double" libsqlite3)
          (list '* int)))
        (value-text
         (pointer->procedure
          '*
          (dynamic-pointer "sqlite3_column_text" libsqlite3)
          (list '* int)))
        (value-blob
         (pointer->procedure
          '*
          (dynamic-pointer "sqlite3_column_blob" libsqlite3)
          (list '* int)))
        (value-bytes
         (pointer->procedure
          int
          (dynamic-pointer "sqlite3_column_bytes" libsqlite3)
          (list '* int))))
    (lambda (stmt i)
      (assert-live-stmt! stmt)
      (case (value-type (stmt-pointer stmt) i)
        ((1) ; SQLITE_INTEGER
         (value-int (stmt-pointer stmt) i))
        ((2) ; SQLITE_FLOAT
         (value-double (stmt-pointer stmt) i))
        ((3) ; SQLITE3_TEXT
         (let ((p (value-blob (stmt-pointer stmt) i)))
           (if (null-pointer? p)
               ""
               (utf8->string
                (pointer->bytevector p (value-bytes (stmt-pointer stmt) i))))))
        ((4) ; SQLITE_BLOB
         (let ((p (value-blob (stmt-pointer stmt) i)))
           (if (null-pointer? p)
               (make-bytevector 0)
               (pointer->bytevector p (value-bytes (stmt-pointer stmt) i)))))
        ((5) ; SQLITE_NULL
         #f)))))

(define (sqlite-column-names stmt)
  (let ((v (make-vector (sqlite-column-count stmt))))
    (let lp ((i 0))
      (if (< i (vector-length v))
          (begin
            (vector-set! v i (sqlite-column-name stmt i))
            (lp (1+ i)))
          v))))

(define (sqlite-row stmt)
  (let ((v (make-vector (sqlite-column-count stmt))))
    (let lp ((i 0))
      (if (< i (vector-length v))
          (begin
            (vector-set! v i (sqlite-column-value stmt i))
            (lp (1+ i)))
          v))))

(define sqlite-busy-timeout
  (let ((f (pointer->procedure
            int
            (dynamic-func "sqlite3_busy_timeout" libsqlite3)
            (list '* int))))
    (lambda (db value)
      (assert-live-db! db)
      (let ((ret (f (db-pointer db) value)))
        (when (not (zero? ret))
          (check-error db 'sqlite-busy-timeout))))))

(define sqlite-step
  (let ((step (pointer->procedure
               int
               (dynamic-pointer "sqlite3_step" libsqlite3)
               (list '*))))
    (lambda (stmt)
      (assert-live-stmt! stmt)
      (let ((ret (step (stmt-pointer stmt))))
        (case ret
          ((100) ; SQLITE_ROW
           (sqlite-row stmt))
          ((101) ; SQLITE_DONE
           #f)
          (else
           (check-error (stmt->db stmt))
           (error "shouldn't get here")))))))

(define (sqlite-fold kons knil stmt)
  (assert-live-stmt! stmt)
  (let lp ((seed knil))
    (let ((row (sqlite-step stmt)))
      (if row
          (lp (kons row seed))
          seed))))

(define (sqlite-fold-right kons knil stmt)
  (assert-live-stmt! stmt)
  (let lp ()
    (let ((row (sqlite-step stmt)))
      (if row
          (kons row (lp))
          knil))))

(define (sqlite-map proc stmt)
  (map proc
       (reverse! (sqlite-fold cons '() stmt))))


code:
;;;; basic.test ---      -*- mode: scheme; coding: utf-8; -*-
;;;;
;;;;   Copyright (C) 2011 Detlev Zundel <dzu@denx.de>
;;;;
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
;;;; License as published by the Free Software Foundation; either
;;;; version 3 of the License, or (at your option) any later version.
;;;;
;;;; This library is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
;;;; Lesser General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU Lesser General Public
;;;; License along with this library; if not, write to the Free Software
;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

(define-module (tests basic-test)
  #:use-module (ice-9 format)
  #:use-module (sqlite3))

(define (sqlite-exec* db sql key value)
  (let ((stmt (sqlite-prepare db sql)))
    (sqlite-bind stmt key value)
    (sqlite-map display stmt)))

;; Cleanup database so we can check creation
(define db-name "tests/simple.db")
(if (file-exists? db-name)
    (begin
      (format #t "Removing leftover database ~a~%" db-name)
      (delete-file db-name)))

(format #t "Creating test database ~a:" db-name)
(define db (sqlite-open db-name (logior SQLITE_OPEN_CREATE
                                        SQLITE_OPEN_READWRITE)))
(format #t "~40tOk~%")

(sqlite-busy-timeout db 20)

(format #t "Creating table 'project':")
(sqlite-exec
 db
 "create table project (
      reference integer primary key,
      name   text,
      website   text
  )")
(format #t "~40tOk~%")

(format #t "Inserting a dataset:")
(sqlite-exec db "insert into project values (1, 'Guile', '')")
(format #t "~40tOk~%")

(let* ((s "SELECT * FROM project")
       (stmt (sqlite-prepare db s #:cache? #t)))
  (unless (eq? stmt (sqlite-prepare db s #:cache? #t))
    (error "caching is not caching much!")))

(format #t "Reading dataset: ")
(sqlite-exec db "select * from project")
(format #t "~40tOk~%")

(format #t "Reading dataset with named parameter: ")
(sqlite-exec* db "select * from project where 'bla' = :foo" ":foo" "bla")
(format #t "~40tOk~%")

(format #t "Reading dataset with named parameter, v2: ")
(sqlite-exec* db "select * from project where 'bla' = :foo" 'foo "bla")
(format #t "~40tOk~%")

(format #t "Inserting a dataset using sqlite-bind: ")
(sqlite-exec db "CREATE TABLE foos (dbid INTEGER PRIMARY KEY, name TEXT)")
(let ((stmt (sqlite-prepare db "INSERT INTO foos(name) VALUES(?)")))
  (sqlite-bind stmt 1 "myfoo")
  (sqlite-step stmt)
  (sqlite-finalize stmt))
(sqlite-exec db "DROP TABLE IF EXISTS foos")
(format #t "~40tOk~%")

(sqlite-close db)

(format #t "Removing database ~a" db-name)
(delete-file db-name)
(format #t "~40tOk~%")

(exit 0)


code:
# ---> Python
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
#  Usually these files are written by a python script from a template
#  before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover

# Translations
*.mo
*.pot

# Django stuff:
*.log

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# PyCharm
.idea/


code:
# db_project_utmn

Проект для предмета Базы данных


code:
from models import *
from datetime import date

directions = [Direction(1, "Исит"),
              Direction(2, "Ибас"),
              Direction(3, "Моаис"),
              Direction(4, "КБ"),
              Direction(5, "ПИ"),
              Direction(6, "Психология"),
              Direction(7, "Физика"),
              Direction(8, "Таможенное дело"),
              Direction(9, "Социология"),
              Direction(10, "Философия")]

students = [Student(1, "Ропов", directions[3]),
            Student(2, "Меньшикова", directions[5]),
            Student(3, "Иванов", directions[1]),
            Student(4, "Смирнов", directions[0]),
            Student(5, "Латыпов", directions[6]),
            Student(6, "Сидоров", directions[2]),
            Student(7, "Михайлов", directions[2]),
            Student(8, "Антипин", directions[4]),
            Student(9, "Рожков", directions[0]),
            Student(10, "Смецкой", directions[3])]

laborants = [Laborant(1, "Александров"),
             Laborant(2, "Фурзикова"),
             Laborant(3, "Паняев"),
             Laborant(4, "Сергеев"),
             Laborant(5, "Якушев"),
             Laborant(6, "Собянин"),
             Laborant(7, "Кондратьева"),
             Laborant(8, "Семихин"),
             Laborant(9, "Семихина"),
             Laborant(10, "Платонов")]

cabinets = [Cabinet(1, "5-210"),
            Cabinet(2, "12-101"),
            Cabinet(3, "12-201"),
            Cabinet(4, "5-317"),
            Cabinet(5, "5-111"),
            Cabinet(6, "4-420"),
            Cabinet(7, "4-413"),
            Cabinet(8, "5-209"),
            Cabinet(9, "11-508а"),
            Cabinet(10, "4-308")]

entries = [Entry(1, cabinets[1], students[2], laborants[4], 5, 4, date(2023, 11, 5)),
           Entry(2, cabinets[0], students[4], laborants[3], 4, 3, date(2023, 11, 6)),
           Entry(3, cabinets[9], students[5], laborants[4], 3, 2, date(2023, 11, 7)),
           Entry(4, cabinets[8], students[6], laborants[1], 7, 4, date(2023, 11, 7)),
           Entry(5, cabinets[6], students[1], laborants[0], 8, 1, date(2023, 11, 8)),
           Entry(6, cabinets[5], students[0], laborants[9], 9, 2, date(2023, 11, 8)),
           Entry(7, cabinets[7], students[2], laborants[5], 1, 3, date(2023, 11, 9)),
           Entry(8, cabinets[1], students[7], laborants[5], 2, 3, date(2023, 11, 9)),
           Entry(9, cabinets[0], students[8], laborants[2], 5, 4, date(2023, 11, 9)),
           Entry(10, cabinets[4], students[9], laborants[8], 10, 2, date(2023, 11, 10))]


code:
from kivymd.uix.datatables import MDDataTable
from kivy.metrics import dp

class EntriesViews:
    def __init__(self, entries: list = None):
        if entries is None:
            entries = []
        self.entries = entries

    def view(self):
        data_tables = MDDataTable(
            size_hint=(1, 1),
            rows_num=10**6,
            column_data=[
                ("ID", dp(10)),
                ("Номер пары", dp(25)),
                ("Номер компьютера", dp(25)),
                ("Фамилия студента", dp(25)),
                ("Дата", dp(20)),
                ("Фамилия лаборанта", dp(25)),
                ("Название кабинета", dp(20)),

            ],
            row_data=[
                i.to_row() for i in self.entries
            ],
        )

        return data_tables

class DirectionsViews:
    def __init__(self, directions: list = None):
        self.directions = directions

    def view(self):
        data_tables = MDDataTable(
            size_hint=(1, 1),
            rows_num=10**6,
            column_data=[
                ("ID", dp(10)),
                ("Название направления", dp(35)),

            ],
            row_data=[
                i.to_row() for i in self.directions
            ],
        )

        return data_tables

class LaborantsViews:
    def __init__(self, laborants: list = None):
        self.laborants = laborants

    def view(self):

        data_tables = MDDataTable(
            size_hint=(1, 1),
            rows_num=10**6,
            column_data=[
                ("ID", dp(10)),
                ("Фамилия лаборанта", dp(35)),

            ],
            row_data=[
                i.to_row() for i in self.laborants
            ],
        )

        return data_tables

class CabinetsViews:
    def __init__(self, cabinets: list = None):
        self.cabinets = cabinets

    def view(self):

        data_tables = MDDataTable(
            size_hint=(1, 1),
            rows_num=10**6,
            column_data=[
                ("ID", dp(10)),
                ("Название кабинета", dp(35)),

            ],
            row_data=[
                i.to_row() for i in self.cabinets
            ],
        )

        return data_tables

class StudentsViews:
    def __init__(self, students: list = None):
        self.students = students

    def view(self):

        data_tables = MDDataTable(
            size_hint=(1, 1),
            rows_num=10**6,
            column_data=[
                ("ID", dp(10)),
                ("Фамилия студента", dp(35)),
                ("Название направления", dp(30))

            ],
            row_data=[
                i.to_row() for i in self.students
            ],
        )

        return data_tables


code:
from typing import Any

from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import create_engine, Column, Integer, String, ForeignKey, select, Date, delete
from sqlalchemy.orm import sessionmaker, relationship, as_declarative, contains_eager, joinedload
import models

@as_declarative()
class Base:
    # Базовый класс для объектов User и Task
    pass

class Cabinet(Base):
    __tablename__ = 'cabinet'
    id = Column(Integer, primary_key=True, nullable=False)
    name = Column(String, nullable=False, unique=True)
    entries = relationship('Entry', cascade='all, delete', back_populates="cabinet")

    def __init__(self, id=None, name=None):
        self.id = id
        self.name = name

    def to_model(self) -> models.Cabinet:
        return models.Cabinet(id=self.id, name=self.name)

class Direction(Base):
    __tablename__ = 'direction'
    id = Column(Integer, primary_key=True, nullable=False)
    name = Column(String, nullable=False, unique=True)
    students = relationship('Student', cascade='all, delete', back_populates='direction')

    def __init__(self, id=None, name=None):
        self.id = id
        self.name = name

    def to_model(self) -> models.Direction:
        return models.Direction(id=self.id, name=self.name)

class Laborant(Base):
    __tablename__ = 'laborant'
    id = Column(Integer, primary_key=True, nullable=False)
    second_name = Column(String, nullable=False)
    entries = relationship('Entry', cascade='all, delete', back_populates='laborant')

    def __init__(self, id=None, second_name=None):
        self.id = id
        self.second_name = second_name

    def to_model(self) -> models.Laborant:
        return models.Laborant(id=self.id, second_name=self.second_name)

def laborant_from_model(model: models.Laborant) -> Laborant:
    return Laborant(id=model.id, second_name=model.second_name)

class Student(Base):
    __tablename__ = 'student'
    id = Column(Integer, primary_key=True, nullable=False)
    name = Column(String, nullable=False)
    direction_id = Column(Integer, ForeignKey('direction.id'), nullable=False)
    direction = relationship("Direction")
    entries = relationship('Entry', cascade='all, delete', back_populates='student')

    def __init__(self, id=None, name=None, direction_id=None):
        self.id = id
        self.name = name
        self.direction_id = direction_id

    def to_model(self) -> models.Student:
        return models.Student(id=self.id, name=self.name, direction=self.direction.to_model())

class Entry(Base):
    __tablename__ = 'entry'
    id = Column(Integer, primary_key=True, nullable=False)
    cabinet_id = Column(Integer, ForeignKey('cabinet.id'), nullable=False)
    cabinet = relationship("Cabinet", back_populates='entries')
    student_id = Column(Integer, ForeignKey('student.id'), nullable=False)
    student = relationship("Student", back_populates='entries')
    laborant_id = Column(Integer, ForeignKey('laborant.id'), nullable=False)
    laborant = relationship("Laborant", back_populates='entries')
    comp_num = Column(Integer, nullable=False)
    lesson_num = Column(Integer, nullable=False)
    lesson_date = Column(Date, nullable=False)

    def __init__(self, id=None, cabinet_id=None, student_id=None, laborant_id=None, comp_num=None, lesson_num=None,
                 lesson_date=None):
        self.id = id
        self.student_id = student_id
        self.cabinet_id = cabinet_id
        self.laborant_id = laborant_id
        self.lesson_date = lesson_date
        self.lesson_num = lesson_num
        self.comp_num = comp_num

    def to_model(self) -> models.Entry:
        return models.Entry(id=self.id, cabinet=self.cabinet.to_model(), student=self.student.to_model(),
                            laborant=self.laborant.to_model(), comp_num=self.comp_num, lesson_num=self.lesson_num,
                            lesson_date=self.lesson_date)

# url: postgresql://postgres:postgres@localhost:5432/journal
class ControllerDB:
    def __init__(self, url: str):
        self.url = url
        self.engine = create_engine(url)
        self.session = sessionmaker(bind=self.engine)
        Base.metadata.create_all(self.engine)

    def get_page(self, obj, page: int = 1, size: int = 10):
        page = max(page, 1)
        s = self.session()
        content = s.query(obj).limit(size).offset((page - 1) * size).all()
        total = s.query(obj).count()
        if total % size == 0:
            total_pages = total // size
        else:
            total_pages = total // size + 1
        content = list(map(lambda m: m.to_model(), content))
        return models.Page(content, page, total_pages, size)

    # Get page
    def get_directions_page(self, page: int = 1, size: int = 10) -> models.Page:
        return self.get_page(Direction, page, size)

    def get_cabinets_page(self, page: int = 1, size: int = 10) -> models.Page:
        return self.get_page(Cabinet, page, size)

    def get_laborants_page(self, page: int = 1, size: int = 10) -> models.Page:
        return self.get_page(Laborant, page, size)

    def get_students_page(self, page: int = 1, size: int = 10) -> models.Page:
        return self.get_page(Student, page, size)

    def get_entries_page(self, page: int = 1, size: int = 10) -> models.Page:
        return self.get_page(Entry, page, size)

    def get_one(self, obj, id: int) -> Any:
        return self.get_one_db_obj(obj, id).to_model()

    def get_one_db_obj(self, obj, id: int):
        s = self.session()
        ans = s.query(obj).filter_by(id=id).one()
        return ans

    def get_all_db_obj(self, obj) -> list:
        s = self.session()
        ans = s.query(obj).all()
        return ans

    def get_all(self, obj):
        s = self.session()
        ans = s.query(obj).all()
        ms = list(map(lambda m: m.to_model(), ans))
        s.close()
        return ms

    def get_all_directions(self) -> list:
        return self.get_all(Direction)

    def get_all_cabinets(self) -> list:
        return self.get_all(Cabinet)

    def get_all_laborants(self) -> list:
        return self.get_all(Laborant)

    def get_all_students(self) -> list:
        return self.get_all(Student)

    def get_all_entries(self) -> list:
        return self.get_all(Entry)

    # Get one
    def get_direction(self, id: int) -> models.Direction:
        return self.get_one(Direction, id)

    def get_cabinet(self, id: int) -> models.Cabinet:
        return self.get_one(Cabinet, id)

    def get_laborant(self, id: int) -> models.Laborant:
        return self.get_one(Laborant, id)

    def get_student(self, id: int) -> models.Student:
        return self.get_one(Student, id)

    def get_entry(self, id: int) -> models.Entry:
        return self.get_one(Entry, id)

    def update(self, obj, model):
        s = self.session()
        db_obj = self.get_one_db_obj(obj, model.id)
        for k, v in model:
            setattr(db_obj, k, v)
        s.merge(db_obj)
        s.commit()
        s.refresh(db_obj)
        m = db_obj.to_model()
        s.close()
        return m

    # Update
    def update_direction(self, direction: models.Direction) -> models.Direction:
        return self.update(Direction, direction)

    def update_cabinet(self, cabinet: models.Cabinet) -> models.Cabinet:
        return self.update(Cabinet, cabinet)

    def update_laborant(self, laborant: models.Laborant) -> models.Laborant:
        return self.update(Laborant, laborant)

    def update_student(self, student: models.Student) -> models.Student:
        return self.update(Student, student)

    def update_entry(self, entry: models.Entry) -> models.Entry:
        return self.update(Entry, entry)

    def delete(self, obj, id: int):
        s = self.session()
        obj = self.get_one_db_obj(obj, id)
        obj = s.merge(obj)
        s.delete(obj)
        s.commit()
        s.close()

    # Delete
    def delete_direction(self, id: int) -> None:
        self.delete(Direction, id)

    def delete_cabinet(self, id: int) -> None:
        self.delete(Cabinet, id)

    def delete_laborant(self, id: int) -> None:
        self.delete(Laborant, id)

    def delete_student(self, id: int) -> None:
        self.delete(Student, id)

    def delete_entry(self, id: int) -> None:
        self.delete(Entry, id)

    # create
    def create_direction(self, direction: models.Direction) -> models.Direction:
        s = self.session()
        db_obj = Direction(name=direction.name)
        s.add(db_obj)
        s.commit()
        s.refresh(db_obj)
        return db_obj.to_model()

    def create_cabinet(self, cabinet: models.Cabinet) -> models.Cabinet:
        s = self.session()
        db_obj = Cabinet(name=cabinet.name)
        s.add(db_obj)
        s.commit()
        s.refresh(db_obj)
        return db_obj.to_model()

    def create_laborant(self, laborant: models.Laborant) -> models.Laborant:
        s = self.session()
        db_obj = Laborant(second_name=laborant.second_name)
        s.add(db_obj)
        s.commit()
        s.refresh(db_obj)
        return db_obj.to_model()

    def create_student(self, student: models.Student) -> models.Student:
        s = self.session()
        db_obj = Student(name=student.name, direction_id=student.direction.id)
        s.add(db_obj)
        s.commit()
        s.refresh(db_obj)
        return db_obj.to_model()

    def create_entry(self, entry: models.Entry) -> models.Entry:
        s = self.session()
        db_obj = Entry(student_id=entry.student.id, cabinet_id=entry.cabinet.id, laborant_id=entry.laborant.id,
                       comp_num=entry.comp_num, lesson_num=entry.lesson_num, lesson_date=entry.lesson_date)
        s.add(db_obj)
        s.commit()
        s.refresh(db_obj)
        return db_obj.to_model()