Search Results for 'asp2php'

ATOM Icon

1 POSTS

  1. 2004/11/30 asp2php 사용기 2 by 나현재

asp2php 사용기 2

asp를 php로 포팅해서 쓰겠다는 계획 포기

이유.
1. 포팅하는데 걸리는 시간 너무 길다.(디버깅 시간이 상상을 초월함.)
2. 포팅후 논리적 에러가 너무 많음.
3. 형변환에서 문제 발생.
4. asp2php가 함수의 파라메터에 대한 지원이 너무 약함.
5. 변환 모듈을 추가 한다하더라도 작업량이 너무 많음.


[CODE]asp => php 변환안되는 식 <!--#include virtual="/__sample/frWmSuidSample/frWmSuidSampleHead.asp"--> include $HTTP_SERVER_VARS["APPL_PHYSICAL_PATH"].'phpSample\test\lib\lib.php'; 변환 오류 date() => time()() date() => time() => date("Y.m.d") ; cutDatex(1,date())=>cutDatex(1,time()); =>date("y.m.d") ; if(IsNull( Mid(S, startpos, nextpos - startpos)) => if(IsNull( Mid(S, startpos, nextpos - startpos))) => if(strlen(substr($S,$startpos-1,$nextpos-$startpos))==0) InStr(startpos, S, sep)=>strpos($startpos,$S,$sep) => strpos($S,$sep,$startpos)[/CODE]


테스트 코드 (asp)
[CODE]<!--#include virtual="/frWm/__frWm/__lib/frWmLib.asp"--> <% dim ret ret = Parse("11.222222.333.4",2,".") response.write( "<br/>Parse(""11.222222.333.4"",2,""."") => "&amp;amp;amp;amp;amp;amp;amp;ret) ret= getDatex(1) response.write( "<br/>getDatex(1) => "&amp;amp;amp;amp;amp;amp;amp;ret) ret= cutDatex(1,date()) response.write( "<br/>cutDatex(1,date()) => "&amp;amp;amp;amp;amp;amp;amp;ret) %>[/CODE]


테스트 코드(php)
[CODE]<?php include $HTTP_SERVER_VARS["APPL_PHYSICAL_PATH"].'frWm\__frWm\__lib\frWmLib.php'; $ret= Parse("11.222222.333.4",2,"."); echo '<br/>Parse("11.222222.333.4",2,".")='.$ret.''; $ret= getDatex(1); echo "<br/>getDatex(1) => ". $ret; $red= cutDatex(0,date("Y.m.d")); echo '<br/>cutDatex(0,date("Y.m.d")) "This moudule is not completed..!"=> '. $red; ?> [/CODE]


변환할 모듈(asp)
[CODE]<% ' 날짜에서 시간을 잘라 "02.01.01"형식으로 변형함 Function cutDatex(datetypex,datex) dim cutDatexRet if datetypex = 0 then '일반타입으로 리턴 cutDatexRet= datex else if datetypex = 1 then cutDatexRet= RIGHT(cSTR(YEAR(datex)), 2)+ "." if Month(datex)<10 then cutDatexRet=cutDatexRet+"0"+RIGHT(cSTR(MONTH(datex)), 2) + "." else cutDatexRet=cutDatexRet+RIGHT(cSTR(MONTH(datex)), 2) + "." end if if DAY(datex)<10 then cutDatexRet=cutDatexRet+"0"+RIGHT(cSTR(DAY(datex)), 2) else cutDatexRet=cutDatexRet+RIGHT(cSTR(DAY(datex)), 2) end if end if end if cutDatex = cutDatexRet end Function ' 특정형식으로 오늘 날짜를 변형함(ex) 0=> 일반, 1=>"02.01.01") Function getDatex(datetypex) if datetypex = 0 then getDatex = date() elseif datetypex =1 then getDatex = cutDatex(1,date()) end if end Function '파싱함수 Function Parse(S, n , sep ) 'S = 문자열 'n = 순서 (1부터) 'sep = 구분자 Dim i , startpos , nextpos startpos = 1 For i = 1 To n - 1 nextpos = InStr(startpos, S, sep) If nextpos = 0 Then Exit For startpos = nextpos + Len(sep) Next nextpos = InStr(startpos, S, sep) If nextpos = 0 Then If i <= n - 1 Then Parse = "" Else Parse = Mid(S, startpos) End If Else if IsNull( Mid(S, startpos, nextpos - startpos)) then 'isNull => len() = 0 Parse="" else Parse = Mid(S, startpos, nextpos - startpos) end if End If End Function %>[/CODE]



변환된 모듈(php)
[CODE]<? // 날짜에서 시간을 잘라 "02.01.01"형식으로 변형함 function cutDatex($datetypex,$datex) { extract($GLOBALS); if ($datetypex==0) { //일반타입으로 리턴 $cutDatexRet=$datex; } else { if ($datetypex==1) { $d=1/0; /* not work so break err.....u must complete this code.! $m =; $d =; $y =subStr($datey,); $cutDatexRet= subStr(date("Y.m.d",mktime(0, 0, 0, $m, $d, $y))),2,8); */ } } $cutDatex=$cutDatexRet; return $cutDatex; } // 특정형식으로 오늘 날짜를 변형함(ex) 0=> 일반, 1=>"02.01.01") function getDatex($datetypex) { extract($GLOBALS); if ($datetypex=="0") { $getDatex=date("Y.m.d"); } else if ($datetypex=="1") { $getDatex=date("y.m.d") ; } return $getDatex; } //파싱함수 function Parse($S,$n,$sep) { extract($GLOBALS); $Parse=""; //S = 문자열 //n = 순서 (1부터) //sep = 구분자 $startpos=1; for ($i=1; $i<=$n-1; $i=$i+1) { $nextpos=(strpos($S,$sep,$startpos) ? strpos($S,$sep,$startpos)+1 : 0); if ($nextpos==0) { break; } $startpos=$nextpos+strlen($sep); } $nextpos=(strpos($S,$sep,$startpos) ? strpos($S,$sep,$startpos)+1 : 0); if ($nextpos==0) { if ($i<=$n-1) { $Parse=""; } else { $Parse=substr($S,$startpos-1); } } else { if (strlen(substr($S,$startpos-1,$nextpos-$startpos))==0) { $Parse=""; } else { $Parse=substr($S,$startpos-1,$nextpos-$startpos); } } return $Parse; } ?>[/CODE]
이올린에 북마크하기

Posted by 나현재

2004/11/30 13:46 2004/11/30 13:46
Response
16 Trackbacks , No Comment
RSS :
http://j.finfra.com/tt/rss/response/144


블로그 이미지

Insufficient memory! So,Blog is my 2nd Brain!

- 나현재

Notices

Archives

Authors

  1. 나현재

Calendar

«   2012/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    

Site Stats

Total hits:
205602
Today:
16
Yesterday:
22