울트라 에디터 사용시 루아 파일 블록 지정 코맨트 설정을 해주어야 제대로 볼 수 있다.
this is does not correct action block comment ...
--[[
--]]
/L20"Lua" Line Comment Num = 3-- Escape Char = \ Block Comment On = --[[ Block Comment Off = ]] String Chars = "' File Extensions = LUA BIN
/Delimiters = ~!@%^&*()-+=|\/{}[]:;"'<> , .?
/Function String = "%[a-zA-Z]*)"
/C1 "key words"
and
do
else elseif end
function
if
local
nil not
or
repeat return
then
until
while
/C2
abs acos appendto ascii asin assert atan atan2
call ceil clock collectgarbage copytagmethods cos
date deg dofile dostring
error execute exit
floor foreach foreachvar format frexp
getbinmethod getenv getglobal gettagmethod gsub
ldexp log log10
max min mod
newtag next nextvar
print
rad random randomseed rawgetglobal rawgettable rawsetglobal rawsettable read
readfrom remove rename
seterrormethod setglobal setlocale settag settagmethod sin sqrt strbyte
strchar strfind strlen strlower strrep strsub strupper
tag tan tmpname tonumber tostring type
write writeto
/C3
$debug
$else
$end
$endinput
$if
$ifnot
$nodebug
/C4
PI
_INPUT _OUTPUT _STDERR _STDIN _STDOUT
/C5
+
-
*
// /
^
<
>
=
~
%
.
:
/C6
;
,
(
)
{
}
[
]
/C7
cgi cgilua cgilua_url char2hexa chdir
dbluaerrorfb dblua_escape decode default_script
encodecgi encodetable escape
filetype
getvalue
hexa hexa2char html_mask
includehtml insertfield
lua_mask
maketable map mkurl
nopipe
preprocess
redirect relativeurl relative_url
saveluavar savestate script_path script_pdir script_vdir stateerrormethod
statefile stdin strsplit
unescape
/C8
DBClose DBExec DBOpen DBRow
3/15/2010
11/11/2009
c++ namespace, class print
c++ namespace, class print
#include
namespace A
{
class B
{
public:
B() {}
void print()
{
printf("%s:%d .....\n",
__PRETTY_FUNCTION__, __LINE__);
}
};
};
int main(int argc, char** argv)
{
A::B b;
b.print();
return 0;
}
result
void A::B::print():13
#include
namespace A
{
class B
{
public:
B() {}
void print()
{
printf("%s:%d .....\n",
__PRETTY_FUNCTION__, __LINE__);
}
};
};
int main(int argc, char** argv)
{
A::B b;
b.print();
return 0;
}
result
void A::B::print():13
std::list and find class object.
#include
#include
#include
#include
#include
#include
#include
class PERSON {
public:
size_t m_no;
std::string m_name;
public:
PERSON(size_t no, const char* name)
{
m_no = no;
m_name = name;
}
int operator==(const PERSON& p) const
{
return (p.m_no == m_no && p.m_name == m_name);
}
};
typedef std::list
typedef std::list
int get_random(size_t lo, size_t hi)
{
return (int)((double)rand() /
((double)RAND_MAX + 1) * (++hi - lo) + lo);
}
int main()
{
PersonList list;
srandom(getpid() * time(0));
for (size_t i=0; i<10; i++)
{
list.push_back(PERSON(get_random(1, 100), "ddd"));
}
printf("orig...\n");
PersonListIt it = list.begin();
while (it != list.end())
{
PERSON& p = *it;
printf("no:%d name:%s\n", p.m_no, p.m_name.c_str());
it++;
}
PersonListIt findIt = find(list.begin(), list.end(), PERSON(4, "ddd"));
if (findIt != list.end())
{
printf("found...\n");
}
return 0;
}
orig...
no:14 name:ddd
no:54 name:ddd
no:12 name:ddd
no:70 name:ddd
no:100 name:ddd
no:43 name:ddd
no:43 name:ddd
no:37 name:ddd
no:63 name:ddd
no:64 name:ddd
위 예제는, std::list에 PERSON이라는 객체를 집어넣고
find을 이용해서 찾는 예제입니다.
11/06/2009
ln -s and rm
symbolic link
ln -s (src dir) (symbolic name)
remove symbolic link.
rm (symbolic name) -- correct.
rm (symbolic name)/ -- incorrect.
ln -s (src dir) (symbolic name)
remove symbolic link.
rm (symbolic name) -- correct.
rm (symbolic name)/ -- incorrect.
11/04/2009
pointer pointer array - for memory
#define MAX_PATH 128
class TestPointer
{
private:
char strBuffer** m_pstrBuffer;
public:
void read_text_file( char* _strFileName );
};
void TestPointer::read_text_file( char* _strFileName )
{
int strNum;
//...........
m_pStrBuffer = (char**)new char[strNum];
m_pStrBuffer = (char*)new char[MAX_PATH];
char szbuf[128];
fprintf( fp, "%s", szbuf );
strcpy( m_pStrBuffer[index], szbuf );
}
void clear(void)
{
for( int i = 0; i < strNum; ++i )
delete m_pStrBuffer[index];
delete m_pStrBuffer;
}
class TestPointer
{
private:
char strBuffer** m_pstrBuffer;
public:
void read_text_file( char* _strFileName );
};
void TestPointer::read_text_file( char* _strFileName )
{
int strNum;
//...........
m_pStrBuffer = (char**)new char[strNum];
m_pStrBuffer = (char*)new char[MAX_PATH];
char szbuf[128];
fprintf( fp, "%s", szbuf );
strcpy( m_pStrBuffer[index], szbuf );
}
void clear(void)
{
for( int i = 0; i < strNum; ++i )
delete m_pStrBuffer[index];
delete m_pStrBuffer;
}
피드 구독하기:
덧글 (Atom)