무플 무서워요

'Source Insight'에 해당되는 글 1건

  1. 2008.03.05 Source Insight Feature 추가하는 Macro

/*====*====*====*====*====*====*====*====*====*====*====*====*====*====*====*

                                  M A C R O

GENERAL DESCRIPTION
 

EXTERNALIZED FUNCTIONS

INITIALIZATION AND SEQUENCING REQUIREMENTS

*====*====*====*====*====*====*====*====*====*====*====*====*====*====*====*/


macro InsertDS()
{
  InsertDefined("_ui_bee_feature")
}

macro InsertUP()
{
  InsertDefined("_UI_TC_LANG")
}

macro Insert_SMTP()
{
  InsertDefined("_ds_smtp")
}

macro Insert_BT()
{
  InsertDefined("_UP_MMC_FILE")
}

macro InsertNULLDefined()
{
  InsertDefined("")
}
macro InsertAuthor()
{
  local_time = GetSysTime(1)

  index1 = FindString(local_time,"year=\"")
  tmp_local_time = strmid(local_time,index1+8,strlen(local_time))
  index2 = FindString(tmp_local_time,"\"")
  year  = strmid(tmp_local_time,0,index2)
 
  index1 = FindString(local_time,"month=\"")
  tmp_local_time = strmid(local_time,index1+7,strlen(local_time))
  index2 = FindString(tmp_local_time,"\"")
  month  = strmid(tmp_local_time,0,index2)
 
  index1 = FindString(local_time,"day=\"")
  tmp_local_time = strmid(local_time,index1+5,strlen(local_time))
  index2 = FindString(tmp_local_time,"\"")
  day  = strmid(tmp_local_time,0,index2)

  index1 = FindString(local_time,"hour=\"")
  tmp_local_time = strmid(local_time,index1+6,strlen(local_time))
  index2 = FindString(tmp_local_time,"\"")
  hour  = strmid(tmp_local_time,0,index2)

  index1 = FindString(local_time,"minute=\"")
  tmp_local_time = strmid(local_time,index1+8,strlen(local_time))
  index2 = FindString(tmp_local_time,"\"")
  minute  = strmid(tmp_local_time,0,index2)

  str = "/* "
  str = Cat(str,year)
  str = Cat(str,"-")
  if(strlen(month) == 1)
 str = Cat(str,"0")
  str = Cat(str,month)
  str = Cat(str,"-")
  if(strlen(day) == 1)
   str = Cat(str,"0")
  str = Cat(str,day)

  if(hour >= 12)
 morning = "PM"    
  else
   morning = "AM"
 
  if(hour > 12)
   hour = hour - 12

  str = Cat(str," ")
  if(strlen(hour) == 1)
   str = Cat(str,"0")
  str = Cat(str,hour)
  str = Cat(str,":")
  if(strlen(minute) == 1)
   str = Cat(str,"0")
  str = Cat(str,minute)
  str = Cat(str,morning)
 
  str = Cat(str," _DaSom */")
  hbuf = GetCurrentBuf()
  ln = GetBufLnCur (hbuf)

hwnd = GetCurrentWnd()
lnFirst = GetWndSelLnFirst(hwnd)
//lnLast = GetWndSelLnLast(hwnd)
 
//  InsBufLine(hbuf,lnFirst,"/* CommentHere */")
  InsBufLine(hbuf,lnFirst,str)
//  InsBufLine(hbuf, lnLast+3, "#else  /* @sz@ */")
//  InsBufLine(hbuf, lnLast+4, "#endif /* @sz@ */")
}

macro InsertDefined(sz)
{
  local_time = GetSysTime(1)

  index1 = FindString(local_time,"year=\"")
  tmp_local_time = strmid(local_time,index1+8,strlen(local_time))
  index2 = FindString(tmp_local_time,"\"")
  year  = strmid(tmp_local_time,0,index2)
 
  index1 = FindString(local_time,"month=\"")
  tmp_local_time = strmid(local_time,index1+7,strlen(local_time))
  index2 = FindString(tmp_local_time,"\"")
  month  = strmid(tmp_local_time,0,index2)
 
  index1 = FindString(local_time,"day=\"")
  tmp_local_time = strmid(local_time,index1+5,strlen(local_time))
  index2 = FindString(tmp_local_time,"\"")
  day  = strmid(tmp_local_time,0,index2)

  index1 = FindString(local_time,"hour=\"")
  tmp_local_time = strmid(local_time,index1+6,strlen(local_time))
  index2 = FindString(tmp_local_time,"\"")
  hour  = strmid(tmp_local_time,0,index2)

  index1 = FindString(local_time,"minute=\"")
  tmp_local_time = strmid(local_time,index1+8,strlen(local_time))
  index2 = FindString(tmp_local_time,"\"")
  minute  = strmid(tmp_local_time,0,index2)

  if (sz == "")
    sz = Ask("Enter #ifdef condition:")
  if (sz == "")
    sz = "ez_bt_feature"
  sz= toupper(sz)
  str = "#ifdef @sz@ /* "
  str = Cat(str,year)
  str = Cat(str,"-")
  if(strlen(month) == 1)
 str = Cat(str,"0")
  str = Cat(str,month)
  str = Cat(str,"-")
  if(strlen(day) == 1)
   str = Cat(str,"0")
  str = Cat(str,day)

  if(hour >= 12)
 morning = "PM"    
  else
   morning = "AM"
 
  if(hour > 12)
   hour = hour - 12

  str = Cat(str," ")
  if(strlen(hour) == 1)
   str = Cat(str,"0")
  str = Cat(str,hour)
  str = Cat(str,":")
  if(strlen(minute) == 1)
   str = Cat(str,"0")
  str = Cat(str,minute)
  str = Cat(str,morning)
 
  str = Cat(str," SJ Yang */")
  hbuf = GetCurrentBuf()
  ln = GetBufLnCur (hbuf)

hwnd = GetCurrentWnd()
lnFirst = GetWndSelLnFirst(hwnd)
lnLast = GetWndSelLnLast(hwnd)
 
  InsBufLine(hbuf,lnFirst,"/* CommentHere */")
  InsBufLine(hbuf,lnFirst+1,str)
  InsBufLine(hbuf, lnLast+3, "#else  /* @sz@ */")
  InsBufLine(hbuf, lnLast+4, "#endif /* @sz@ */")
}

macro InsertTime()
{
  local_time = GetSysTime(1)

  index1 = FindString(local_time,"year=\"")
  tmp_local_time = strmid(local_time,index1+8,strlen(local_time))
  index2 = FindString(tmp_local_time,"\"")
  year  = strmid(tmp_local_time,0,index2)
 
  index1 = FindString(local_time,"month=\"")
  tmp_local_time = strmid(local_time,index1+7,strlen(local_time))
  index2 = FindString(tmp_local_time,"\"")
  month  = strmid(tmp_local_time,0,index2)
 
  index1 = FindString(local_time,"day=\"")
  tmp_local_time = strmid(local_time,index1+5,strlen(local_time))
  index2 = FindString(tmp_local_time,"\"")
  day  = strmid(tmp_local_time,0,index2)

  index1 = FindString(local_time,"hour=\"")
  tmp_local_time = strmid(local_time,index1+6,strlen(local_time))
  index2 = FindString(tmp_local_time,"\"")
  hour  = strmid(tmp_local_time,0,index2)

  index1 = FindString(local_time,"minute=\"")
  tmp_local_time = strmid(local_time,index1+8,strlen(local_time))
  index2 = FindString(tmp_local_time,"\"")
  minute  = strmid(tmp_local_time,0,index2)

  str = "//"
  str = Cat(str,year)
  str = Cat(str,"-")
  if(strlen(month) == 1)
 str = Cat(str,"0")
  str = Cat(str,month)
  str = Cat(str,"-")
  if(strlen(day) == 1)
   str = Cat(str,"0")
  str = Cat(str,day)

  if(hour >= 12)
 morning = "PM"    
  else
   morning = "AM"
 
  if(hour > 12)
   hour = hour - 12

  str = Cat(str," ")
  if(strlen(hour) == 1)
   str = Cat(str,"0")
  str = Cat(str,hour)
  str = Cat(str,":")
  if(strlen(minute) == 1)
   str = Cat(str,"0")
  str = Cat(str,minute)
  str = Cat(str,morning)
  str = Cat(str," happycat")
  hbuf = GetCurrentBuf()
  ln = GetBufLnCur (hbuf)
  ich = GetBufLineLength(hbuf,ln)
  SetBufIns (hbuf, ln, ich)
  InsBufLine(hbuf,ln+1,str)
}

macro FindString( source, target )
{
 source_len = strlen( source )
 target_len = strlen( target )
 match = 0
 cp = 0
 while( cp < source_len )
 {
  while( cp < source_len )
  {
   if( source[cp] == target[0] )
    break
   else
    cp = cp + 1
  }
  if( cp == source_len )
      break;
  k = cp
  j = 0
  while( j < target_len && source[k] == target[j] )
  {
   k = k + 1
   j = j + 1
  }
  if (j == target_len)
  {
   match = 1
   break
  }
  cp = cp + 1
 }
 if( match )
  return cp
 else
  return "X"
}

아하하하하 정리는 나중에 ㅡㅡ;;

'Tech&Tip' 카테고리의 다른 글

Timestamp Web Conveter  (0) 2010.04.30
짜증나는 방통위의 010 번호 통합 Rule.  (0) 2010.03.03
모니터 보정하기  (0) 2010.03.02
MSN, NATE ON 광고 없애기와 기억력 감퇴....  (0) 2010.02.25
윈도우즈 탐새끼(?) 띄우기  (0) 2007.11.28
Posted by DaSom

카테고리

분류 전체보기 (100)
Scribble (48)
Tech&Tip (8)
Creative (9)
Develop (20)
IT (2)
언론 (9)
추천사이트 (4)

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

달력

«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

글 보관함