Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Constants.hs #75

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 31 additions & 59 deletions lslforge/haskell/src/Language/Lsl/Internal/Constants.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# OPTIONS_GHC -XNoMonomorphismRestriction #-}
module Language.Lsl.Internal.Constants where

import Data.Bits((.|.),shiftL)
Expand All @@ -16,6 +16,7 @@ cInventoryBodyPart = 13;llcInventoryBodyPart :: RealFloat a => LSLValue a; llcIn
cInventoryClothing = 5;llcInventoryClothing :: RealFloat a => LSLValue a; llcInventoryClothing = IVal cInventoryClothing
cInventoryGesture = 21;llcInventoryGesture :: RealFloat a => LSLValue a; llcInventoryGesture = IVal cInventoryGesture
cInventoryLandmark = 3;llcInventoryLandmark :: RealFloat a => LSLValue a; llcInventoryLandmark = IVal cInventoryLandmark
cInventoryMaterial = 57;llcInventoryMaterial :: RealFloat a => LSLValue a; llcInventoryMaterial = IVal cInventoryMaterial
cInventoryNotecard = 7;llcInventoryNotecard :: RealFloat a => LSLValue a; llcInventoryNotecard = IVal cInventoryNotecard
cInventoryNone = (-1);llcInventoryNone :: RealFloat a => LSLValue a;llcInventoryNone = IVal cInventoryNone
cInventoryObject = 6;llcInventoryObject :: RealFloat a => LSLValue a; llcInventoryObject = IVal cInventoryObject
Expand Down Expand Up @@ -60,7 +61,7 @@ cDebugChannel = 2147483647 :: LSLInteger
llcDebugChannel = IVal cDebugChannel

cEOF = "\n\n\n"
llcEOF = SVal cEOF
llcEOF = (SVal cEOF)

cPermissionControlCamera = 0x800 :: LSLInteger
llcPermissionControlCamera = IVal cPermissionControlCamera
Expand Down Expand Up @@ -106,6 +107,7 @@ cPrimType = 9;llcPrimType :: RealFloat a => LSLValue a; llcPrimType = IVal cPrim

cParcelDetailsName = 0;llcParcelDetailsName :: RealFloat a => LSLValue a; llcParcelDetailsName = IVal cParcelDetailsName
cParcelDetailsDesc = 1;llcParcelDetailsDesc :: RealFloat a => LSLValue a; llcParcelDetailsDesc = IVal cParcelDetailsDesc
cParcelDetailsFlags = 12;llcParcelDetailsFlags :: RealFloat a => LSLValue a; llcParcelDetailsFlags = IVal cParcelDetailsFlags
cParcelDetailsOwner = 2;llcParcelDetailsOwner :: RealFloat a => LSLValue a; llcParcelDetailsOwner = IVal cParcelDetailsOwner
cParcelDetailsGroup = 3;llcParcelDetailsGroup :: RealFloat a => LSLValue a; llcParcelDetailsGroup = IVal cParcelDetailsGroup
cParcelDetailsArea = 4;llcParcelDetailsArea :: RealFloat a => LSLValue a; llcParcelDetailsArea = IVal cParcelDetailsArea
Expand All @@ -119,8 +121,7 @@ cClickActionOpen = 4;llcClickActionOpen :: RealFloat a => LSLValue a; llcClickAc
cClickActionPlay = 5;llcClickActionPlay :: RealFloat a => LSLValue a; llcClickActionPlay = IVal cClickActionPlay
cClickActionOpenMedia = 6;llcClickActionOpenMedia :: RealFloat a => LSLValue a; llcClickActionOpenMedia = IVal cClickActionOpenMedia
cClickActionZoom = 7;llcClickActionZoom :: RealFloat a => LSLValue a; llcClickActionZoom = IVal cClickActionZoom
cClickActionDisabled = 8;llcClickActionDisabled :: RealFloat a => LSLValue a; llcClickActionDisabled = IVal cClickActionDisabled
cClickActions = [cClickActionTouch,cClickActionSit,cClickActionBuy,cClickActionPay,cClickActionOpen,cClickActionPlay,cClickActionOpenMedia,cClickActionZoom,cClickActionDisabled]
cClickActions = [cClickActionTouch,cClickActionSit,cClickActionBuy,cClickActionPay,cClickActionOpen,cClickActionPlay,cClickActionOpenMedia,cClickActionZoom]

cDataBorn = 3;llcDataBorn :: RealFloat a => LSLValue a; llcDataBorn = IVal cDataBorn
cDataName = 2;llcDataName :: RealFloat a => LSLValue a; llcDataName = IVal cDataName
Expand Down Expand Up @@ -264,6 +265,7 @@ allConstants = [
Constant "CHANGED_OWNER" (IVal 0x80),
Constant "CHANGED_REGION" (IVal 0x100),
Constant "CHANGED_REGION_START" llcChangedRegionStart,
Constant "CHANGED_RENDER_MATERIAL" (IVal 0x1000),
Constant "CHANGED_SCALE" (IVal 0x8),
Constant "CHANGED_SHAPE" (IVal 0x4),
Constant "CHANGED_TELEPORT" (IVal 0x200),
Expand Down Expand Up @@ -296,9 +298,9 @@ allConstants = [
Constant "CLICK_ACTION_PAY" llcClickActionPay,
Constant "CLICK_ACTION_PLAY" llcClickActionPlay,
Constant "CLICK_ACTION_SIT" llcClickActionSit,
Constant "CLICK_ACTION_DISABLED" llcClickActionTouch,
Constant "CLICK_ACTION_TOUCH" llcClickActionTouch,
Constant "CLICK_ACTION_ZOOM" llcClickActionZoom,
Constant "CLICK_ACTION_DISABLED" llcClickActionDisabled,
Constant "CONTENT_TYPE_ATOM" (IVal 0x04),
Constant "CONTENT_TYPE_FORM" (IVal 0x07),
Constant "CONTENT_TYPE_HTML" (IVal 0x01),
Expand Down Expand Up @@ -329,15 +331,6 @@ allConstants = [
Constant "DEBUG_CHANNEL" llcDebugChannel,
Constant "DEG_TO_RAD" (FVal 0.01745329238),
Constant "DENSITY" (IVal 1),
Constant "ENV_NOT_EXPERIENCE" (IVal (-1)),
Constant "ENV_NO_EXPERIENCE_PERMISSION" (IVal (-2)),
Constant "ENV_NO_ENVIRONMENT" (IVal (-3)),
Constant "ENV_INVALID_AGENT" (IVal (-4)),
Constant "ENV_INVALID_RULE" (IVal (-5)),
Constant "ENV_VALIDATION_FAIL" (IVal (-6)),
Constant "ENV_NO_EXPERIENCE_LAND" (IVal (-7)),
Constant "ENV_THROTTLE" (IVal (-8)), -- Not implemented yet?
Constant "ENVIRONMENT_DAYINFO" (IVal 200),
Constant "EOF" $ SVal cEOF,
Constant "ERR_GENERIC" (IVal (-1)),
Constant "ERR_MALFORMED_PARAMS" (IVal (-3)),
Expand All @@ -361,35 +354,23 @@ allConstants = [
Constant "HTTP_BODY_MAXLENGTH" llcHTTPBodyMaxlength,
Constant "HTTP_BODY_TRUNCATED" llcHTTPBodyTruncated,
Constant "HTTP_CUSTOM_HEADER" (IVal 5),
Constant "HTTP_EXTENDED_ERROR" (IVal 9),
Constant "HTTP_METHOD" llcHTTPMethod,
Constant "HTTP_MIMETYPE" llcHTTPMimetype,
Constant "HTTP_PRAGMA_NO_CACHE" (IVal 6),
Constant "HTTP_USER_AGENT" (IVal 7),
Constant "HTTP_VERBOSE_THROTTLE" (IVal 4),
Constant "HTTP_VERIFY_CERT" llcHTTPVerifyCert,
Constant "IMG_USE_BAKED_HEAD" (KVal $ LSLKey "5a9f4a74-30f2-821c-b88d-70499d3e7183"),
Constant "IMG_USE_BAKED_UPPER" (KVal $ LSLKey "ae2de45c-d252-50b8-5c6e-19f39ce79317"),
Constant "IMG_USE_BAKED_LOWER" (KVal $ LSLKey "24daea5f-0539-cfcf-047f-fbc40b2786ba"),
Constant "IMG_USE_BAKED_EYES" (KVal $ LSLKey "52cc6bb6-2ee5-e632-d3ad-50197b1dcb8a"),
Constant "IMG_USE_BAKED_SKIRT" (KVal $ LSLKey "43529ce8-7faa-ad92-165a-bc4078371687"),
Constant "IMG_USE_BAKED_HAIR" (KVal $ LSLKey "09aac1fb-6bce-0bee-7d44-caac6dbb6c63"),
Constant "IMG_USE_BAKED_LEFTARM" (KVal $ LSLKey "ff62763f-d60a-9855-890b-0c96f8f8cd98"),
Constant "IMG_USE_BAKED_LEFTLEG" (KVal $ LSLKey "8e915e25-31d1-cc95-ae08-d58a47488251"),
Constant "IMG_USE_BAKED_AUX1" (KVal $ LSLKey "9742065b-19b5-297c-858a-29711d539043"),
Constant "IMG_USE_BAKED_AUX2" (KVal $ LSLKey "03642e83-2bd1-4eb9-34b4-4c47ed586d2d"),
Constant "IMG_USE_BAKED_AUX3" (KVal $ LSLKey "edd51b77-fc10-ce7a-4b3d-011dfc349e4f"),
Constant "INVENTORY_ALL" llcInventoryAll,
Constant "INVENTORY_ANIMATION" llcInventoryAnimation,
Constant "INVENTORY_BODYPART" llcInventoryBodyPart,
Constant "INVENTORY_CLOTHING" llcInventoryClothing,
Constant "INVENTORY_GESTURE" llcInventoryGesture,
Constant "INVENTORY_LANDMARK" llcInventoryLandmark,
Constant "INVENTORY_MATERIAL" llcInventoryMaterial,
Constant "INVENTORY_NONE" llcInventoryNone,
Constant "INVENTORY_NOTECARD" llcInventoryNotecard,
Constant "INVENTORY_OBJECT" llcInventoryObject,
Constant "INVENTORY_SCRIPT" llcInventoryScript,
Constant "INVENTORY_SETTING" (IVal 56), -- TODO: Change to llcInventorySetting
Constant "INVENTORY_SOUND" llcInventorySound,
Constant "INVENTORY_TEXTURE" llcInventoryTexture,
Constant "JSON_APPEND" (IVal (-1)),
Expand Down Expand Up @@ -424,6 +405,15 @@ allConstants = [
Constant "LAND_REVERT" (IVal 5),
Constant "LAND_SMALL_BRUSH" (IVal 1),
Constant "LAND_SMOOTH" (IVal 3),
Constant "LINKSETDATA_DELETE" (IVal (2)),
Constant "LINKSETDATA_EMEMORY" (IVal (1)),
Constant "LINKSETDATA_ENOKEY" (IVal (2)),
Constant "LINKSETDATA_EPROTECTED" (IVal (3)),
Constant "LINKSETDATA_NOTFOUND" (IVal (4)),
Constant "LINKSETDATA_MOUPDATE" (IVal (5)),
Constant "LINKSETDATA_OK" (IVal (0)),
Constant "LINKSETDATA_RESET" (IVal (0)),
Constant "LINKSETDATA_UPDATE" (IVal (1)),
Constant "LINK_ALL_CHILDREN" (IVal (-3)),
Constant "LINK_ALL_OTHERS" (IVal (-2)),
Constant "LINK_ROOT" (IVal 1),
Expand Down Expand Up @@ -504,6 +494,7 @@ allConstants = [
Constant "PARCEL_COUNT_TOTAL" (IVal 0),
Constant "PARCEL_DETAILS_AREA" llcParcelDetailsArea,
Constant "PARCEL_DETAILS_DESC" llcParcelDetailsDesc,
Constant "PARCEL_DETAILS_FLAGS" llcParcelDetailsFlags,
Constant "PARCEL_DETAILS_GROUP" llcParcelDetailsGroup,
Constant "PARCEL_DETAILS_ID" (IVal 5),
Constant "PARCEL_DETAILS_NAME" llcParcelDetailsName,
Expand Down Expand Up @@ -575,8 +566,8 @@ allConstants = [
Constant "PRIM_ALPHA_MODE" (IVal 38),
Constant "PRIM_ALPHA_MODE_NONE" (IVal 0),
Constant "PRIM_ALPHA_MODE_BLEND" (IVal 1),
Constant "PRIM_ALPHA_MODE_MASK" (IVal 2),
Constant "PRIM_ALPHA_MODE_EMISSIVE" (IVal 3),
Constant "PRIM_ALPHA_MODE_MASK" (IVal 2),
Constant "PRIM_BUMP_BARK" (IVal 4),
Constant "PRIM_BUMP_BLOBS" (IVal 12),
Constant "PRIM_BUMP_BRICKS" (IVal 5),
Expand Down Expand Up @@ -649,6 +640,11 @@ allConstants = [
Constant "PRIM_POINT_LIGHT" llcPrimPointLight,
Constant "PRIM_POSITION" llcPrimPosition,
Constant "PRIM_POS_LOCAL" (IVal 33),
Constant "PRIM_PROJECTOR" (IVal 42),
Constant "PRIM_REFLECTION_PROBE" (IVal 44),
Constant "PRIM_REFLECTION_PROBE_BOX" (IVal 1),
Constant "PRIM_REFLECTION_PROBE_DYNAMIC" (IVal 2),
Constant "PRIM_RENDER_MATERIAL" (IVal 43),
Constant "PRIM_ROTATION" llcPrimRotation,
Constant "PRIM_ROT_LOCAL" (IVal 29),
Constant "PRIM_SCRIPTED_SIT_ONLY" (IVal 40),
Expand Down Expand Up @@ -794,33 +790,18 @@ allConstants = [
Constant "SIT_INVALID_LINK" (IVal (-5)),
Constant "SIT_NO_ACCESS" (IVal (-6)),
Constant "SIT_INVALID_OBJECT" (IVal (-7)),
Constant "SKY_ABSORPTION_CONFIG" (IVal 16),
Constant "SKY_AMBIENT" (IVal 0),
Constant "SKY_CLOUD_TEXTURE" (IVal 19),
Constant "SKY_CLOUDS" (IVal 2),
Constant "SKY_DENSITY_PROFILE_COUNTS" (IVal 3),
Constant "SKY_DOME" (IVal 4),
Constant "SKY_GAMMA" (IVal 5),
Constant "SKY_GLOW" (IVal 6),
Constant "SKY_LIGHT" (IVal 8),
Constant "SKY_MIE_CONFIG" (IVal 17),
Constant "SKY_MOON_TEXTURE" (IVal 20),
Constant "SKY_MOON" (IVal 9),
Constant "SKY_PLANET" (IVal 10),
Constant "SKY_RAYLEIGH_CONFIG" (IVal 18),
Constant "SKY_REFRACTION" (IVal 11),
Constant "SKY_STAR_BRIGHTNESS" (IVal 13),
Constant "SKY_SUN_TEXTURE" (IVal 21),
Constant "SKY_SUN" (IVal 14),
Constant "SKY_TEXTURE_DEFAULTS" (IVal 1),
Constant "SKY_TRACKS" (IVal 15),
Constant "SMOOTH" (IVal 0x10),
Constant "SOUND_LOOP" (IVal 0x01),
Constant "SOUND_PLAY" (IVal 0x00),
Constant "SOUND_SYNC" (IVal 0x02),
Constant "SOUND_TRIGGER" (IVal 0x04),
Constant "SQRT2" (FVal 1.414213538),
Constant "STATUS_BLOCK_GRAB" (IVal 0x40),
Constant "STATUS_BLOCK_GRAB_OBJECT" (IVal 0x400),
Constant "STATUS_BOUNDS_ERROR" (IVal 1002),
Constant "STATUS_CAST_SHADOWS" (IVal 0x200),
Constant "STATUS_DIE_AT_EDGE" (IVal 0x80),
Constant "STATUS_DIE_AT_NO_ENTRY" (IVal 0x800),
Constant "STATUS_INTERNAL_ERROR" (IVal 1999),
Constant "STATUS_MALFORMED_PARAMS" (IVal 1000),
Constant "STATUS_NOT_FOUND" (IVal 1003),
Expand All @@ -838,7 +819,6 @@ allConstants = [
Constant "STRING_TRIM" (IVal 0x03),
Constant "STRING_TRIM_HEAD" (IVal 0x01),
Constant "STRING_TRIM_TAIL" (IVal 0x02),
Constant "TARGETED_EMAIL_ROOT_CREATOR" (IVal 1),
Constant "TARGETED_EMAIL_OBJECT_OWNER" (IVal 2),
Constant "TEXTURE_BLANK" (KVal $ LSLKey "5748decc-f629-461c-9a36-a35a221fe21f"),
Constant "TEXTURE_DEFAULT" (KVal $ LSLKey "89556747-24cb-43ed-920b-47caed15465f"),
Expand Down Expand Up @@ -905,14 +885,6 @@ allConstants = [
Constant "VEHICLE_VERTICAL_ATTRACTION_TIMESCALE" (IVal 37),
Constant "VERTICAL" (IVal 0),
Constant "WANDER_PAUSE_AT_WAYPOINTS" (IVal 0),
Constant "WATER_BLUR_MULTIPLIER" (IVal 100),
Constant "WATER_FOG" (IVal 101),
Constant "WATER_FRESNEL" (IVal 102),
Constant "WATER_NORMAL_SCALE" (IVal 104),
Constant "WATER_NORMAL_TEXTURE" (IVal 107),
Constant "WATER_REFRACTION" (IVal 105),
Constant "WATER_TEXTURE_DEFAULTS" (IVal 103),
Constant "WATER_WAVE_DIRECTION" (IVal 106),
Constant "XP_ERROR_NONE" (IVal 0),
Constant "XP_ERROR_THROTTLED" (IVal 1),
Constant "XP_ERROR_EXPERIENCES_DISABLED" (IVal 2),
Expand Down Expand Up @@ -940,10 +912,10 @@ findConstant :: RealFloat a => String -> Maybe (Constant a)
findConstant s = find (\ c -> s == constName c) allConstants

findConstVal :: RealFloat a => String -> Maybe (LSLValue a)
findConstVal s = constVal <$> findConstant s
findConstVal s = fmap constVal $ findConstant s

findConstType :: String -> Maybe LSLType
findConstType s = typeOfLSLValue <$> findConstVal s
findConstType s = fmap typeOfLSLValue $ findConstVal s

isConstant :: String -> Bool
isConstant s =
Expand Down