Commit 4e65e7f6 authored by Peter Achten's avatar Peter Achten
Browse files

PA: Bug removed in syncSend(2).

parent 69ee3529
......@@ -55,25 +55,25 @@ ALL : "$(OUTDIR)\Windows_C_12.exe" "$(OUTDIR)\Windows_C_12.bsc"
CLEAN :
-@erase ".\Release\Windows_C_12.bsc"
-@erase ".\Release\cCrossCall_12.sbr"
-@erase ".\Release\cdebug_12.sbr"
-@erase ".\Release\util_12.sbr"
-@erase ".\Release\cpicture_12.sbr"
-@erase ".\Release\cOSGameLib_12.sbr"
-@erase ".\Release\ddutil.sbr"
-@erase ".\Release\cGameLib_12.sbr"
-@erase ".\Release\cprinter_12.sbr"
-@erase ".\Release\cCrossCall_12.sbr"
-@erase ".\Release\util_12.sbr"
-@erase ".\Release\cdebug_12.sbr"
-@erase ".\Release\Dsutil.sbr"
-@erase ".\Release\cOSGameLib_12.sbr"
-@erase ".\Release\cGameLib_12.sbr"
-@erase ".\Release\cpicture_12.sbr"
-@erase ".\Release\Windows_C_12.exe"
-@erase ".\Release\cOSGameLib_12.obj"
-@erase ".\Release\cCrossCall_12.obj"
-@erase ".\Release\cdebug_12.obj"
-@erase ".\Release\util_12.obj"
-@erase ".\Release\cpicture_12.obj"
-@erase ".\Release\cOSGameLib_12.obj"
-@erase ".\Release\ddutil.obj"
-@erase ".\Release\cGameLib_12.obj"
-@erase ".\Release\cprinter_12.obj"
-@erase ".\Release\cCrossCall_12.obj"
-@erase ".\Release\util_12.obj"
-@erase ".\Release\cdebug_12.obj"
-@erase ".\Release\Dsutil.obj"
-@erase ".\Release\cGameLib_12.obj"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
......@@ -95,15 +95,15 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
BSC32_FLAGS=/nologo /o"$(OUTDIR)/Windows_C_12.bsc"
BSC32_SBRS= \
"$(INTDIR)/cCrossCall_12.sbr" \
"$(INTDIR)/cdebug_12.sbr" \
"$(INTDIR)/util_12.sbr" \
"$(INTDIR)/cpicture_12.sbr" \
"$(INTDIR)/cOSGameLib_12.sbr" \
"$(INTDIR)/ddutil.sbr" \
"$(INTDIR)/cGameLib_12.sbr" \
"$(INTDIR)/cprinter_12.sbr" \
"$(INTDIR)/cCrossCall_12.sbr" \
"$(INTDIR)/util_12.sbr" \
"$(INTDIR)/cdebug_12.sbr" \
"$(INTDIR)/Dsutil.sbr" \
"$(INTDIR)/cOSGameLib_12.sbr"
"$(INTDIR)/cGameLib_12.sbr" \
"$(INTDIR)/cpicture_12.sbr"
"$(OUTDIR)\Windows_C_12.bsc" : "$(OUTDIR)" $(BSC32_SBRS)
$(BSC32) @<<
......@@ -119,15 +119,15 @@ LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
/pdb:"$(OUTDIR)/Windows_C_12.pdb" /machine:I386\
/out:"$(OUTDIR)/Windows_C_12.exe"
LINK32_OBJS= \
"$(INTDIR)/cOSGameLib_12.obj" \
"$(INTDIR)/cCrossCall_12.obj" \
"$(INTDIR)/cdebug_12.obj" \
"$(INTDIR)/util_12.obj" \
"$(INTDIR)/cpicture_12.obj" \
"$(INTDIR)/cOSGameLib_12.obj" \
"$(INTDIR)/ddutil.obj" \
"$(INTDIR)/cGameLib_12.obj" \
"$(INTDIR)/cprinter_12.obj" \
"$(INTDIR)/Dsutil.obj"
"$(INTDIR)/cCrossCall_12.obj" \
"$(INTDIR)/util_12.obj" \
"$(INTDIR)/cdebug_12.obj" \
"$(INTDIR)/Dsutil.obj" \
"$(INTDIR)/cGameLib_12.obj"
"$(OUTDIR)\Windows_C_12.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
......@@ -155,15 +155,15 @@ CLEAN :
-@erase ".\Debug\vc40.pdb"
-@erase ".\Debug\vc40.idb"
-@erase ".\Debug\Windows_C_12.exe"
-@erase ".\Debug\util_12.obj"
-@erase ".\Debug\cCrossCall_12.obj"
-@erase ".\Debug\ddutil.obj"
-@erase ".\Debug\cpicture_12.obj"
-@erase ".\Debug\cGameLib_12.obj"
-@erase ".\Debug\Dsutil.obj"
-@erase ".\Debug\cprinter_12.obj"
-@erase ".\Debug\cOSGameLib_12.obj"
-@erase ".\Debug\util_12.obj"
-@erase ".\Debug\cdebug_12.obj"
-@erase ".\Debug\cCrossCall_12.obj"
-@erase ".\Debug\ddutil.obj"
-@erase ".\Debug\cprinter_12.obj"
-@erase ".\Debug\Dsutil.obj"
-@erase ".\Debug\Windows_C_12.ilk"
-@erase ".\Debug\Windows_C_12.pdb"
......@@ -195,15 +195,15 @@ LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
/pdb:"$(OUTDIR)/Windows_C_12.pdb" /debug /machine:I386\
/out:"$(OUTDIR)/Windows_C_12.exe"
LINK32_OBJS= \
"$(INTDIR)/util_12.obj" \
"$(INTDIR)/cpicture_12.obj" \
"$(INTDIR)/cGameLib_12.obj" \
"$(INTDIR)/cOSGameLib_12.obj" \
"$(INTDIR)/cdebug_12.obj" \
"$(INTDIR)/cCrossCall_12.obj" \
"$(INTDIR)/ddutil.obj" \
"$(INTDIR)/cpicture_12.obj" \
"$(INTDIR)/cGameLib_12.obj" \
"$(INTDIR)/Dsutil.obj" \
"$(INTDIR)/cprinter_12.obj" \
"$(INTDIR)/Dsutil.obj"
"$(INTDIR)/cOSGameLib_12.obj" \
"$(INTDIR)/util_12.obj" \
"$(INTDIR)/cdebug_12.obj"
"$(OUTDIR)\Windows_C_12.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
......@@ -253,7 +253,8 @@ DEP_CPP_CCROS=\
".\cCrossCall_12.h"\
".\cpicture_12.h"\
".\cGameLib_12.h"\
".\cprinter_12.c"\
".\cprinter_12.h"\
".\cTCP.h"\
{$(INCLUDE)}"\htmlhelp.h"\
".\util_12.h"\
".\intrface_12.h"\
......@@ -263,18 +264,15 @@ DEP_CPP_CCROS=\
".\Ddutil.h"\
".\Dsutil.h"\
"\dx5sdk\sdk\inc\d3dtypes.h"\
".\..\..\..\..\dx5sdk\sdk\inc\d3dvec.inl"\
".\cprinter_12.h"\
"..\..\..\..\..\dx5sdk\sdk\inc\d3dvec.inl"\
NODEP_CPP_CCROS=\
".\..\..\..\..\dx5sdk\sdk\inc\subwtype.h"\
"..\..\..\..\..\dx5sdk\sdk\inc\subwtype.h"\
"$(INTDIR)\cCrossCall_12.obj" : $(SOURCE) $(DEP_CPP_CCROS) "$(INTDIR)"\
".\cprinter_12.c"
"$(INTDIR)\cCrossCall_12.obj" : $(SOURCE) $(DEP_CPP_CCROS) "$(INTDIR)"
"$(INTDIR)\cCrossCall_12.sbr" : $(SOURCE) $(DEP_CPP_CCROS) "$(INTDIR)"\
".\cprinter_12.c"
"$(INTDIR)\cCrossCall_12.sbr" : $(SOURCE) $(DEP_CPP_CCROS) "$(INTDIR)"
!ELSEIF "$(CFG)" == "Windows_C_12 - Win32 Debug"
......@@ -283,18 +281,17 @@ DEP_CPP_CCROS=\
".\cCrossCall_12.h"\
".\cpicture_12.h"\
".\cGameLib_12.h"\
".\cprinter_12.c"\
".\cprinter_12.h"\
".\cTCP.h"\
{$(INCLUDE)}"\htmlhelp.h"\
".\util_12.h"\
".\intrface_12.h"\
".\cOSGameLib_12.h"\
".\Ddutil.h"\
".\Dsutil.h"\
".\cprinter_12.h"\
"$(INTDIR)\cCrossCall_12.obj" : $(SOURCE) $(DEP_CPP_CCROS) "$(INTDIR)"\
".\cprinter_12.c"
"$(INTDIR)\cCrossCall_12.obj" : $(SOURCE) $(DEP_CPP_CCROS) "$(INTDIR)"
!ENDIF
......@@ -426,10 +423,10 @@ DEP_CPP_CGAME=\
".\Ddutil.h"\
".\Dsutil.h"\
"\dx5sdk\sdk\inc\d3dtypes.h"\
".\..\..\..\..\dx5sdk\sdk\inc\d3dvec.inl"\
"..\..\..\..\..\dx5sdk\sdk\inc\d3dvec.inl"\
NODEP_CPP_CGAME=\
".\..\..\..\..\dx5sdk\sdk\inc\subwtype.h"\
"..\..\..\..\..\dx5sdk\sdk\inc\subwtype.h"\
"$(INTDIR)\cGameLib_12.obj" : $(SOURCE) $(DEP_CPP_CGAME) "$(INTDIR)"
......@@ -470,10 +467,10 @@ DEP_CPP_COSGA=\
".\Ddutil.h"\
".\Dsutil.h"\
"\dx5sdk\sdk\inc\d3dtypes.h"\
".\..\..\..\..\dx5sdk\sdk\inc\d3dvec.inl"\
"..\..\..\..\..\dx5sdk\sdk\inc\d3dvec.inl"\
NODEP_CPP_COSGA=\
".\..\..\..\..\dx5sdk\sdk\inc\subwtype.h"\
"..\..\..\..\..\dx5sdk\sdk\inc\subwtype.h"\
"$(INTDIR)\cOSGameLib_12.obj" : $(SOURCE) $(DEP_CPP_COSGA) "$(INTDIR)"
......@@ -538,10 +535,10 @@ DEP_CPP_DSUTI=\
".\Dsutil.h"\
"\dx5sdk\sdk\inc\d3dtypes.h"\
"\dx5sdk\sdk\inc\ddraw.h"\
".\..\..\..\..\dx5sdk\sdk\inc\d3dvec.inl"\
"..\..\..\..\..\dx5sdk\sdk\inc\d3dvec.inl"\
NODEP_CPP_DSUTI=\
".\..\..\..\..\dx5sdk\sdk\inc\subwtype.h"\
"..\..\..\..\..\dx5sdk\sdk\inc\subwtype.h"\
"$(INTDIR)\Dsutil.obj" : $(SOURCE) $(DEP_CPP_DSUTI) "$(INTDIR)"
......
......@@ -68,6 +68,7 @@ getReceiverSelectState :: ! Id !(IOSt .l .p) -> (!Maybe SelectState,!IOSt .l .p
| SendUnknownReceiver
| SendUnableReceiver
| SendDeadlock
| OtherSendReport !String
instance == SendReport
instance toString SendReport
......
......@@ -273,28 +273,33 @@ where
| SendUnknownReceiver
| SendUnableReceiver
| SendDeadlock
| OtherSendReport !String
instance == SendReport where
(==) :: !SendReport !SendReport -> Bool
(==) SendOk report = case report of
SendOk -> True
_ -> False
SendOk -> True
_ -> False
(==) SendUnknownReceiver report = case report of
SendUnknownReceiver -> True
_ -> False
_ -> False
(==) SendUnableReceiver report = case report of
SendUnableReceiver -> True
_ -> False
_ -> False
(==) SendDeadlock report = case report of
SendDeadlock -> True
_ -> False
SendDeadlock -> True
_ -> False
(==) (OtherSendReport s1) report = case report of
OtherSendReport s2 -> s1==s2
_ -> False
instance toString SendReport where
toString :: !SendReport -> {#Char}
toString SendOk = "SendOk"
toString SendUnknownReceiver= "SendUnknownReceiver"
toString SendUnableReceiver = "SendUnableReceiver"
toString SendDeadlock = "SendDeadlock"
toString SendOk = "SendOk"
toString SendUnknownReceiver = "SendUnknownReceiver"
toString SendUnableReceiver = "SendUnableReceiver"
toString SendDeadlock = "SendDeadlock"
toString (OtherSendReport s) = "(OtherSendReport "+++s+++")"
/* Asynchronous, uni-directional, message passing.
......@@ -409,8 +414,11 @@ syncSend2 r2id msg pState
= ((toSendError (fromJust opt_error),Nothing),pState)
| isEmpty resp
= StdReceiverFatalError "syncSend2" "no response received from bi-directional receiver"
# maybe_response = readDynamic (R2IdtoDId` r2id) (hd resp)
| isNothing maybe_response
= ((OtherSendReport "incorrect response received from bi-directional receiver",Nothing),pState)
| otherwise
= ((SendOk,Just (readDynamic (R2IdtoDId` r2id) (hd resp))),pState)
= ((SendOk,maybe_response),pState)
where
PStHandleSync2Message :: !(DId resp) !SyncMessage !(PSt .l .p) -> (!(!SendReport,!Maybe resp), !PSt .l .p)
PStHandleSync2Message did sm pState
......@@ -421,12 +429,18 @@ where
_ -> StdReceiverFatalError "syncSend2" "unexpected scheduler event"
errors = sm.smError
resps = sm.smResp
resp = if (isEmpty resps ) Nothing (Just (readDynamic did (hd resps)))
report = if (isEmpty errors) SendOk (case (hd errors) of
ReceiverUnable -> SendUnableReceiver
ReceiverUnknown -> SendUnknownReceiver
)
= ((report,resp),pState)
| not (isEmpty errors)
# sendReport = case (hd errors) of
ReceiverUnable -> SendUnableReceiver
ReceiverUnknown -> SendUnknownReceiver
= ((sendReport,Nothing),pState)
| isEmpty resps
= StdReceiverFatalError "syncSend2" "no response received from bi-directional receiver"
# maybe_response = readDynamic did (hd resps)
| isNothing maybe_response
= ((OtherSendReport "incorrect response received from bi-directional receiver",Nothing),pState)
| otherwise
= ((SendOk,maybe_response),pState)
toSendError :: !SwitchError -> SendReport
toSendError SwitchToYourself = SendUnknownReceiver
......
......@@ -101,8 +101,7 @@ isSpecialId :: !Id -> Bool
isSpecialId (SpecialId _) = True
isSpecialId _ = False
instance == Id
where
instance == Id where
(==) :: !Id !Id -> Bool
(==) (CustomId id1) id = case id of
(CustomId id2) -> id1==id2
......
......@@ -5,7 +5,7 @@ implementation module receiverhandle
import StdBool, StdInt, StdList
import receivermessage, semidynamic
import cast, receivermessage, semidynamic
from ostoolbox import OSToolbox // MW11++
......@@ -39,18 +39,6 @@ from ostoolbox import OSToolbox // MW11++
:: InetReceiverCategory` :== Int
// ..MW11
/* Conversion functions:
Cast contains abc code because it can't be typed conventionally.
The function Cast is required to break the Existential Type abstraction needed
for message passing. (JVG/RWS)
*/
Cast :: !a -> b
Cast a
= code
{
pop_a 0
}
receiverIdentified :: !Id !(ReceiverHandle .ls .pst) -> Bool
receiverIdentified id {rId}
= id==rId
......@@ -79,14 +67,23 @@ receiverHandleSyncMessage :: !SyncMessage !(ReceiverHandle .ls .pst) (.ls,.pst)
receiverHandleSyncMessage {smRecLoc={rlReceiverId},smMsg} rH=:{rFun} context
| not (receiverIdentified rlReceiverId rH)
= ([],rH,context)
| otherwise
# (ls,resp,pst) = rFun (Cast (getDynamic rlReceiverId smMsg)) context
= ([setDynamic rlReceiverId resp smMsg],rH,(ls,pst))
# maybe_content = getDynamic rlReceiverId smMsg
| isNothing maybe_content
= ([],rH,context)
# (ls,resp,pst) = rFun (Cast (fromJust maybe_content)) context
| isEmpty resp
= ([],rH,(ls,pst))
| otherwise
= ([setDynamic rlReceiverId (hd resp) smMsg],rH,(ls,pst))
receiverAddASyncMessage :: !Id !SemiDynamic !(ReceiverHandle .ls .pst) -> ReceiverHandle .ls .pst
receiverAddASyncMessage id sd rH=:{rASMQ}
| receiverIdentified id rH
= {rH & rASMQ=rASMQ++[Cast (getDynamic id sd)]}
# maybe_content = getDynamic id sd
| isNothing maybe_content
= rH
// otherwise
= {rH & rASMQ=rASMQ++[Cast (fromJust maybe_content)]}
| otherwise
= rH
......
......@@ -27,8 +27,8 @@ import id
*/
openDynamic :: !(DId m) m -> SemiDynamic
matchDynamic:: !(DId m) !SemiDynamic -> Bool
readDynamic :: !(DId m) !SemiDynamic -> m
getDynamic :: !Id !SemiDynamic -> m
readDynamic :: !(DId m) !SemiDynamic -> Maybe m
getDynamic :: !Id !SemiDynamic -> Maybe m
setDynamic :: !Id m !SemiDynamic -> SemiDynamic
RIdtoDId :: !(RId m ) -> DId m
......
......@@ -6,7 +6,7 @@ implementation module semidynamic
*/
import StdBool
import commondef, id
import cast, commondef, id
semidynamicFatalError :: String String -> .x
semidynamicFatalError function error
......@@ -26,19 +26,19 @@ openDynamic did x = {value=x,id=did}
matchDynamic :: !(DId m) !SemiDynamic -> Bool
matchDynamic did {id} = did==id
readDynamic :: !(DId m) !SemiDynamic -> m
readDynamic :: !(DId m) !SemiDynamic -> Maybe m
readDynamic did {value,id}
| did==id
= Cast value
= Just (Cast value)
| otherwise
= semidynamicFatalError "readDynamic" "SemiDynamic did not match argument DId"
= Nothing
getDynamic :: !Id !SemiDynamic -> m
getDynamic :: !Id !SemiDynamic -> Maybe m
getDynamic did {value,id}
| did==id
= Cast value
= Just (Cast value)
| otherwise
= semidynamicFatalError "getDynamic" "SemiDynamic did not match argument Id"
= Nothing
setDynamic :: !Id m !SemiDynamic -> SemiDynamic
setDynamic did x sd=:{id}
......@@ -58,14 +58,3 @@ R2IdtoDId` r2id = R2IdtoId r2id
DIdtoId :: !(DId m) -> Id
DIdtoId did = did
/* Conversion functions:
Cast contains abc code because it can't be typed conventionally.
The function Cast is required to break the Existential Type abstraction.
*/
Cast :: !a -> b
Cast a
= code
{
pop_a 0
}
......@@ -12,6 +12,7 @@ from windowCrossCall_12 import CURSARROW, CURSBUSY, CURSCROSS, CURSFATCROSS, CUR
import commondef, devicesystemstate, windowhandle
from StdControlAttribute import isControlKeyboard
from StdWindowAttribute import isWindowInitActive, getWindowInitActiveAtt
import cast // PA+++
windowaccessFatalError :: String String -> .x
......@@ -663,18 +664,6 @@ genWElementItemNrs nrs _
= (nrs,[])
/* Cast contains abc code because it can't be typed conventionally.
The function Cast is required to break the Existential Type abstraction needed
for retrieving the final modal dialog local state. This code should be replaced as soon as
unique messages can be passed using receivers.
*/
Cast :: !.a -> .b
Cast a
= code
{
pop_a 0
}
getFinalModalLS :: !WID FinalModalLS -> Maybe .ls
getFinalModalLS wid {fmWIDS,fmLS}
| identifyWIDS wid fmWIDS
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment