Skip to content

Commit

Permalink
add missing file
Browse files Browse the repository at this point in the history
  • Loading branch information
dmcoles committed Jul 3, 2024
1 parent 7867e45 commit b18aa20
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions validator.e
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
OPT MODULE, OSVERSION=37

MODULE 'intuition/gadgetclass'

MODULE '*reactionObject','*reactionForm','*stringlist','*dialogs'

//access to main rebuild object list
EXPORT DEF objectList:PTR TO stdlist


EXPORT PROC checkIdent(form:PTR TO reactionForm, editComp:PTR TO reactionObject, id)
DEF str:PTR TO CHAR
DEF comp:PTR TO reactionObject
DEF i
str:=Gets(form.gadgetList[ id ],STRINGA_TEXTVAL)

IF StrLen(str)=0
errorRequest(form.windowObj,'Error','The identifer cannot be blank')
RETURN FALSE
ENDIF

FOR i:=0 TO StrLen(str)-1
IF (str[i]==["_","a" TO "z","A" TO "Z","0" TO "9"])=FALSE
errorRequest(form.windowObj,'Error','The identifer is not valid (A-Z, 0-9 and _)')
RETURN FALSE
ENDIF
ENDFOR

IF objectList
FOR i:=0 TO objectList.count()-1
comp:=objectList.item(i)
IF comp
IF StrCmp(comp.ident,str) AND (editComp<>comp)
errorRequest(form.windowObj,'Error','The identifer is already used')
RETURN FALSE
ENDIF
ENDIF
ENDFOR
ENDIF

ENDPROC TRUE

0 comments on commit b18aa20

Please sign in to comment.