Logical Functions
Pml Basic 6
cleanUrl: "/avevae3d/pmlbasic/pmlbasic6"
floatFirstTOC: rightPML에서의 논리 함수
PML(Programming Macro Language)에서 Logical Fucntions는 주어진 조건에 따라 논리값을 반환하는 함수들입니다. 이 함수들을 사용하면 다양한 조건 검사를 수행하고, 그 결과에 따라 프로그램의 흐름을 제어할 수 있습니다. 아래는 각 논리 함수에 대한 설명과 예제입니다.
1. BADREF 함수
- 개요:
BADREF(id)는id가 유효하지 않으면TRUE를, 유효하면FALSE를 반환합니다. - 예제:이 예제는
TREF가 유효한지 확인합니다.
VAR !TREF nulref
IF (BADREF($!TREF)) THEN
$P 'TREF is invalid'
ELSE
$P 'TREF is valid'
ENDIF2. DEFINED 및 UNDEFINED 함수
- 개요:
- 예제:이 예제는 배열
array가 정의되어 있는지 확인합니다.
VAR !array[1] 'value'
IF (DEFINED(!array)) THEN
$P 'Array is defined'
ENDIF3. EMPTY 함수
- 개요:
EMPTY(text)는text가 빈 문자열이면TRUE를, 그렇지 않으면FALSE를 반환합니다. - 예제:이 예제는 문자열이 비어 있는지 확인합니다.
VAR !text ''
IF (EMPTY(!text)) THEN
$P 'Text is empty'
ELSE
$P 'Text is not empty'
ENDIF4. IFTRUE 함수
- 개요:
IFTRUE(logical, anyA, anyB)는logical이TRUE일 경우anyA를,FALSE일 경우anyB를 반환합니다. - 예제:이 예제는 조건이 참인지 거짓인지에 따라 다른 값을 반환합니다.
VAR !condition TRUE
!result = IFTRUE(!condition, 'TRUE Value', 'FALSE Value')
$P 'Result is: ' + $!result5. MATCHWILD 함수
- 개요:
MATCHWILD(text1, text2)는text1이text2의 패턴과 일치하면TRUE를 반환합니다. 와일드카드를 지원합니다. - 예제:이 예제는 문자열 패턴이 일치하는지 확인합니다.
IF (MATCHWILD('A big bottle of beer', '*big*')) THEN
$P 'Match found'
ELSE
$P 'No match found'
ENDIF6. UNSET 함수
- 개요:
UNSET(value)는value가 설정되지 않았으면TRUE를, 설정되어 있으면FALSE를 반환합니다. - 예제:이 예제는 값이 설정되지 않았는지 확인합니다.
!DESC = nulref
IF (UNSET(!DESC)) THEN
$P 'Description is unset'
ELSE
$P 'Description is set'
ENDIF7. VLOGICAL 함수
- 개요:
VLOGICAL(variable_name)는 변수나 배열 요소의 값을 논리값으로 평가합니다. - 예제:이 예제는 배열 요소가 참인지 거짓인지 확인합니다.
VAR !array[1] 'TRUE'
IF (VLOGICAL(!array, 1)) THEN
$P 'Element is TRUE'
ELSE
$P 'Element is FALSE'
ENDIF<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>네비게이션</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background: transparent;
}
.content {
max-width: 900px;
margin: 60px auto 40px;
padding: 0 20px;
}
/* 구분선 */
.divider {
height: 1px;
background: linear-gradient(to right, transparent, #e0e0e0, transparent);
margin-bottom: 40px;
}
/* 네비게이션 컨테이너 */
.nav-container {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
margin-bottom: 30px;
}
/* 네비게이션 카드 */
.nav-card {
background: white;
border: 2px solid #f0f0f0;
border-radius: 16px;
padding: 30px;
transition: all 0.3s ease;
position: relative;
overflow: hidden;
min-height: 120px;
display: flex;
flex-direction: column;
justify-content: center;
}
.nav-card::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 4px;
background: linear-gradient(90deg, #0356fc, #4a90e2);
transform: scaleX(0);
transition: transform 0.3s ease;
}
.nav-card:hover {
border-color: #0356fc;
transform: translateY(-5px);
box-shadow: 0 8px 24px rgba(3,86,252,0.15);
}
.nav-card:hover::before {
transform: scaleX(1);
}
.nav-label {
font-size: 12px;
font-weight: 600;
color: #999;
text-transform: uppercase;
letter-spacing: 1px;
margin-bottom: 8px;
}
.nav-link {
text-decoration: none;
color: #333;
font-size: 16px;
font-weight: 600;
line-height: 1.4;
transition: color 0.3s ease;
}
.nav-card:hover .nav-link {
color: #0356fc;
}
/* 비활성 카드 */
.nav-card.disabled {
opacity: 0.4;
pointer-events: none;
cursor: not-allowed;
}
.nav-card.disabled::before {
display: none;
}
/* 상위 페이지 버튼 */
.parent-btn-container {
text-align: center;
margin-top: 40px;
}
.parent-btn {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 14px 32px;
background: white;
border: 2px solid #e0e0e0;
border-radius: 12px;
color: #666;
font-size: 15px;
font-weight: 600;
text-decoration: none;
transition: all 0.3s ease;
}
.parent-btn::before {
content: '';
font-size: 18px;
}
.parent-btn:hover {
background: #0356fc;
border-color: #0356fc;
color: white;
transform: translateY(-2px);
box-shadow: 0 4px 16px rgba(3,86,252,0.2);
}
/* 반응형 */
@media (max-width: 768px) {
.content {
margin: 40px auto 20px;
padding: 0 15px;
}
.nav-container {
grid-template-columns: 1fr;
gap: 15px;
}
.nav-card {
padding: 25px;
min-height: 100px;
}
.nav-card.prev::after,
.nav-card.next::after {
font-size: 24px;
}
.nav-link {
font-size: 15px;
}
.parent-btn {
padding: 12px 24px;
font-size: 14px;
}
}
</style>
</head>
<body>
<div class="content">
<div class="divider"></div>
<!-- 네비게이션 -->
<div class="nav-container">
<!-- 이전 게시글 -->
<div class="nav-card prev">
<div class="nav-label">Previous</div>
<a href="/avevae3d/pmlbasic/pmlbasic5" class="nav-link">Object Collection</a>
</div>
<!-- 다음 게시글 -->
<div class="nav-card next">
<div class="nav-label">Next</div>
<a href="/avevae3d/pmlbasic/pmlbasic7" class="nav-link">Object File</a>
</div>
</div>
<!-- 상위 페이지 버튼 -->
<div class="parent-btn-container">
<a href="/avevae3d/pmlbasic" class="parent-btn">목록으로</a>
</div>
</div>
</body>
</html>