프로그램 사용/gcc2010. 1. 27. 17:18
#if 문이라던가 각종 전처리기용 문구들은
여러가지 확장을 통해서 컴파일을 하기 때문에 source insight 등의 힘을 빌려도 분석하기 어려운 면이 있다.

일반적으로 컴파일러는 전처리기 - 컴파일 - 어셈블 - 링크 과정을 거치는데(아마도?)
전처리기 까지만 거친 결과를 stdout 으로 출력해준다.

$ man gcc
       -E  Stop after the preprocessing stage; do not run the compiler proper.
            The output is in the form of preprocessed source code, which is sent to the standard output.

           Input files which don't require preprocessing are ignored.

[링크 : http://linux.die.net/man/1/gcc]

$ cat test.c
#if 1
int test;
#else
int tt;
#endif

int main()
{
        return 0;
}

$ gcc -E test.c
# 1 "test.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "test.c"

int test;




int main()
{
 return 0;
}


#include 하는 모든 파일을 확장하기 때문에, #include <stdio.h>만 해도 내용이 엄청 길어진다.
그리고 줄단위로 처리하기 때문에 사라진 #if 문 대신 엔터만 남아 위와 같이 휑~하게 나왔다.


[링크 : http://cafe.naver.com/devctrl/949]
Posted by 구차니
프로그램 사용/vi2010. 1. 27. 15:42
set 명령어 모음을 보려면(설정된 값들)

:set all 하면 나온다.
우르르르 나오긴 하는데 음.. 머가 먼지는 ㄱ-

:set all
--- 옵션 ---
  aleph=224           foldclose=          mousemodel=extend   swapfile
noarabic              foldcolumn=0        mousetime=500       swapsync=fsync
  arabicshape         foldenable        nonumber              switchbuf=
noallowrevins         foldexpr=0          numberwidth=4       synmaxcol=3000
noaltkeymap           foldignore=#        omnifunc=           syntax=cpp
  ambiwidth=single    foldlevel=0         operatorfunc=       tabline=
noautochdir           foldlevelstart=-1 nopaste               tabpagemax=10
noautoindent          foldmethod=manual   pastetoggle=        tabstop=8
noautoread            foldminlines=1      patchexpr=          tagbsearch
noautowrite           foldnestmax=20      patchmode=          taglength=0
noautowriteall        formatexpr=       nopreserveindent      tagrelative
  background=light    formatoptions=tcq   previewheight=12    tagstack
nobackup              formatprg=        nopreviewwindow       term=xterm
  backupcopy=auto     fsync               printdevice=      notermbidi
  backupext=~       nogdefault            printencoding=      termencoding=
  backupskip=/tmp/*   helpheight=20       printfont=courier noterse
nobinary              helplang=ko         printmbcharset=     textauto
nobomb              nohidden              printmbfont=      notextmode
  bufhidden=          history=50          prompt              textwidth=0
  buflisted         nohkmap               pumheight=0         thesaurus=
  buftype=          nohkmapp              quoteescape=\     notildeop
  cdpath=,,         nohlsearch          noreadonly            timeout
  cedit=^F          noicon                redrawtime=2000     timeoutlen=1000
  charconvert=        iconstring=         remap             notitle
nocindent           noignorecase          report=2            titlelen=85
  cinoptions=         iminsert=0        norevins              titlestring=
  cmdheight=1         imsearch=0        norightleft         nottimeout
  cmdwinheight=7      includeexpr=        ruler               ttimeoutlen=-1
  columns=87        noincsearch           rulerformat=        ttybuiltin
nocompatible          indentexpr=         scroll=28           ttyfast
  completefunc=     noinfercase         noscrollbind          ttymouse=xterm2
noconfirm           noinsertmode          scrolljump=1        ttyscroll=999
nocopyindent          isprint=@,161-255   scrolloff=0         ttytype=xterm
  cpoptions=aABceFs   joinspaces        nosecure              undolevels=1000
  cscopepathcomp=0    key=                selectmode=         updatecount=200
  cscopeprg=cscope    keymap=             shell=/bin/bash     updatetime=4000
  cscopequickfix=     keymodel=           shellcmdflag=-c     verbose=0
nocscopetag           keywordprg=man      shellquote=         verbosefile=
  cscopetagorder=0    langmap=            shelltemp           virtualedit=
nocscopeverbose       langmenu=           shellxquote=      novisualbell
nocursorcolumn        laststatus=1      noshiftround          warn
nocursorline        nolazyredraw          shiftwidth=8      noweirdinvert
  debug=            nolinebreak         noshortname           whichwrap=b,s
nodelcombine          lines=57            showbreak=          wildchar=<Tab>
  dictionary=       nolisp              noshowcmd             wildcharm=0
nodiff              nolist              noshowfulltag         wildignore=
  diffexpr=           listchars=eol:$   noshowmatch         nowildmenu
  diffopt=filler      loadplugins         showmode            wildmode=full
nodigraph             magic               showtabline=1       wildoptions=
  display=            makeef=             sidescroll=0        window=56
  eadirection=both    makeprg=make        sidescrolloff=0     winheight=1
noedcompatible        matchtime=5       nosmartcase         nowinfixheight
  encoding=utf-8      maxcombine=2      nosmartindent       nowinfixwidth
  endofline           maxfuncdepth=100  nosmarttab            winminheight=1
  equalprg=           maxmem=254460     nospell               winwidth=20
noerrorbells          maxmemtot=254460    spellfile=          wrap
  esckeys             menuitems=25        spelllang=en        wrapmargin=0
  eventignore=      nomodeline            spellsuggest=best   wrapscan
noexpandtab           modelines=5       nosplitbelow          write
noexrc                modifiable        nosplitright        nowriteany
  fileformat=unix   nomodified            startofline         writebackup
  filetype=cpp        more                statusline=         writedelay=0
nofkmap               mouse=              suffixesadd=
  backspace=indent,eol,start
  backupdir=.,~/tmp,~/
  breakat= ^I!@*-+;:,./?
  casemap=internal,keepascii
  cinkeys=0{,0},0),:,0#,!^F,o,O,e
  cinwords=if,else,while,do,for,switch
  comments=s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:-
  commentstring=/*%s*/
  complete=.,w,b,u,t,i
  completeopt=menu,preview
  define=^\s*#\s*define
  directory=.,~/tmp,/var/tmp,/tmp
  errorfile=errors.err
  errorformat=%*[^"]"%f"%*\D%l: %m,"%f"%*\D%l: %m,%-G%f:%l: (Each undeclared identifier
 is reported only once,%-G%f:%l: for each function it appears in.),%f:%l:%c:%m,%f(%l):%
m,%f:%l:%m,"%f"\, line %l%*\D%c%*[^ ] %m,%D%*\a[%*\d]: Entering directory `%f',%X%*\a[%
*\d]: Leaving directory `%f',%D%*\a: Entering directory `%f',%X%*\a: Leaving directory
`%f',%DMaking %*\a in %f,%f|%l| %m
  fileencoding=utf-8
  fileencodings=ucs-bom,utf-8,default,latin1
  fileformats=unix,dos
  fillchars=vert:|,fold:-
  foldmarker={{{,}}}
  foldopen=block,hor,mark,percent,quickfix,search,tag,undo
  foldtext=foldtext()
  formatlistpat=^\s*\d\+[\]:.)}\t ]\s*
  grepformat=%f:%l:%m,%f:%l%m,%f  %l%m
  grepprg=grep -n $* /dev/null
  guicursor=n-v-c:block,o:hor50,i-ci:hor15,r-cr:hor30,sm:block
  helpfile=/usr/share/vim/vim72/doc/help.txt
  highlight=8:SpecialKey,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMs
g,M:ModeMsg,n:LineNr,r:Question,s:StatusLine,S:StatusLineNC,c:VertSplit,t:Title,v:Visua
l,V:VisualNOS,w:WarningMsg,W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffChange,D:Di
ffDelete,T:DiffText,>:SignColumn,B:SpellBad,P:SpellCap,R:SpellRare,L:SpellLocal,+:Pmenu
,=:PmenuSel,x:PmenuSbar,X:PmenuThumb,*:TabLine,#:TabLineSel,_:TabLineFill,!:CursorColum
n,.:CursorLine
  include=^\s*#\s*include
  indentkeys=0{,0},:,0#,!^F,o,O,e
  isfname=@,48-57,/,.,-,_,+,,,#,$,%,~,=
  isident=@,48-57,_,192-255
  iskeyword=@,48-57,_,192-255
  lispwords=defun,define,defmacro,set!,lambda,if,case,let,flet,let*,letrec,do,do*,defin
e-syntax,let-syntax,letrec-syntax,destructuring-bind,defpackage,defparameter,defstruct,
deftype,defvar,do-all-symbols,do-external-symbols,do-symbols,dolist,dotimes,ecase,etype
case,eval-when,labels,macrolet,multiple-value-bind,multiple-value-call,multiple-value-p
rog1,multiple-value-setq,prog1,progv,typecase,unless,unwind-protect,when,with-input-fro
m-string,with-open-file,with-open-stream,with-output-to-string,with-package-iterator,de
fine-condition,handler-bind,handler-case,restart-bind,restart-case,with-simple-restart,
store-value,use-value,muffle-warning,abort,continue,with-slots,with-slots*,with-accesso
rs,with-accessors*,defclass,defmethod,print-unreadable-object
  matchpairs=(:),{:},[:]
  maxmempattern=1000
  mkspellmem=460000,2000,500
  nrformats=octal,hex
  paragraphs=IPLPPPQPP TPHPLIPpLpItpplpipbp
  path=.,/usr/include,,
  printexpr=system('lpr' . (&printdevice == '' ? '' : ' -P' . &printdevice) . ' ' . v:f
name_in) . delete(v:fname_in) + v:shell_error
  printheader=%<%f%h%m%=페이지 %N
  printoptions=paper:a4
  rightleftcmd=search
  runtimepath=~/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim72,/
usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,~/.vim/after
  scrollopt=ver,jump
  sections=SHNHH HUnhsh
  selection=inclusive
  sessionoptions=blank,buffers,curdir,folds,help,options,tabpages,winsize
  shellpipe=2>&1| tee
  shellredir=>%s 2>&1
  shortmess=filnxtToO
  spellcapcheck=[.?!]\_[\])'"^I ]\+
  suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.
out,.toc
  tags=./tags,./TAGS,tags,TAGS
  titleold=빔을 날게 해 주셔서 고맙습니다
  viewdir=~/.vim/view
  viewoptions=folds,options,cursor
  viminfo='100,<50,s10,h



[링크 : http://www.eng.hawaii.edu/Tutor/vi.html]
Posted by 구차니
Linux2010. 1. 27. 11:09
patch -p0 < filename 이라고 스크립트가 되어있었는데 귀차니즘으로
patch -p0 filename 라고 했더니 끝나지 않아서 man page에서 확인하니


SYNOPSIS
       patch [options] [originalfile [patchfile]]

       but usually just

       patch -pnum < patchfile

[링크 : http://linux.die.net/man/1/patch]

엄훠 히밤~
착한 아이는 스크립트 대로 하세요~ ㅋㅋ
Posted by 구차니
일단 놀 치프틴 모자 벗길려면 창으로 머리 두방 이상 맞추랜다.. 어쩔 ㄱ-

[링크 : http://www.thisisgame.com/board/view.php?id=321411&board=0&category=12101&subcategory=&page=2&best=&searchmode=&search=&orderby=&token=]



아무튼 맨날 누워서 구경하다가 막상 놀 치프틴을 잡으려니 손발이 후덜후덜
다리가 오그라들지만, 그래도 일단 용감 무식하게 돌진!!





"퍽!!!!"





머.. 이러면 고추되는거임 -ㅁ-


개인적인 리시타 공략법은
  1. 되도록이면 맞지 않는다.
  2. 맞아도 정줄 놓지 않는다면 최대한 회피한다.
아무튼 슬립대시 D랭까지 배운후 슬립스루를 F랭 배우면(이건 F랭 밖에 없는가?) 두번 연타로 회피가 가능해지니
조금더 안정적으로 진행할수 있게 되니, 다른거 올리기 전에 슬립대시 D랭부터 일단 고고싱

아무튼, 7레벨, 컴뱃 B랭, 슬립대시 D랭인 상황인데
(키보드 조작 기준)
S+S+D+A+A 조합으로 치고 빠지니 금세 잡힌다.(물론 무기를 바꾸어서 그렇겠지만)
일단 회피는 공격 타입에 따라서 완전 후진 보다는,
S+S+D+↓+A+→+A 식으로 대각선 방향 빠져주는 것이 좋다.(ㄴ 자로 빠지게 됨)
(음.. 동시에 S+S+D+→+A+A 이렇게 대각선 회피도 되려나?)


개발노트의 타격판정 동영상에서 캡쳐
뒤에있다가 앞으로 나오면서 공격을 하기에 뒤로 빠져도 맞을 가능성이 있으니
되도록이면 대각선 방향으로 빠지는게 유리하다.

다른 "북쪽폐허" 보스들도, 공격을 주의하면서
위와 같은 조합으로 두대만 때리고 도망가고 스태미나 보면서 적당하게 도망다니고
그러면 그리 어렵지 않게 잡을수 있다.


사족 : 밟는걸 몰라서 거미를 못 터트렸는데 ㄱ-

개발자 노트를 보니 A+S 하거나 다운된 몹은 D로 발차기를 할 수 있다고 한다.
[링크 : http://heroes.nexon.com/news/devstory.aspx?no=4&mode=view&page=3]
Posted by 구차니
지하철을 타고 출근하는 건 책을 읽을수 있어서 좋다. (근데 어쩌라구!)



책을 읽다가 보니 문득 드는 생각.
"미래에는 게임이 TV를 대체하지 않을까?"

TV의 단방향성에 비하면
PC의 게임은 어느정도 제한되어는 있지만
"상호작용"을 하며 스스로 내용을 "만들어"가는 구조를 취하고 있다.

자신의 "행동"에 "쾌감"을 느낄수 있으며
TV에서 타인에 의해 만들어지는 컨텐츠에 대한 공감을 끌어내는걸 넘어선 "경험"을 같이하는 "사람"을 만나게 되는
이러한 행위들로 인해, TV와 게임은 다르다고 할 수 있지만 결국에는 대체 되지 않을까라는 생각이 들었다.





(아니면 말구 ㅋㅋ)
Posted by 구차니
프로그램 사용/VLC2010. 1. 26. 17:56
Youtube의 Asteroid Impact (HD) 를 play 하는데 필요한 모듈을 캡쳐했다.



리눅스쪽이 녹색, 윈도우쪽이 파란색이다.
일단 눈에 띄는 차이점은, audio output과 video ouput 부분이다.

'프로그램 사용 > VLC' 카테고리의 다른 글

VLC cross compile시 오류 (vlc-1.0.4)  (0) 2010.02.03
VLC 1.0.4 cross compile + busybox  (0) 2010.02.02
VLC로 youtube 동영상 감상하기  (0) 2010.01.26
youtube mobile on VLC  (0) 2010.01.18
VLC compile [링크]  (0) 2010.01.15
Posted by 구차니
Linux2010. 1. 26. 15:54
How seperate directory and filename from path.

getfilename()
getdirectorypath()

이런식으로 좀 구현해주면 덧나나 싶을 정도로
은근히 검색해도 안나오는 녀석이었는데, 은근히 용도가 많은 녀석이다.

#include <libgen.h>
char *dirname(char *path);
char *basename(char *path);

path          dirname        basename
"/usr/lib"     "/usr"        "lib"
"/usr/"        "/"           "usr"
"usr"          "."           "usr"
"/"            "/"           "/"
"."            "."           "."
".."           "."           ".."


[링크 : http://www.joinc.co.kr/modules/moniwiki/wiki.php/man/3/basename]

path가 절대경로이든, 상대경로이든 dirname()과 basename()은 알아서 분리해준다.

[링크 : http://linux.die.net/man/3/basename]
[링크 : http://linux.die.net/man/3/dirname]

#include <string.h>
char *strdup(const char *s);
#define _GNU_SOURCE
#include <string.h>
char *strndup(const char *s, size_t n);
char *strdupa(const char *s);
char *strndupa(const char *s, size_t n);

The strdup() function returns a pointer to a new string which is a duplicate of the string s. Memory for the new string is obtained with malloc(3), and can be freed with free(3).

[링크 : http://linux.die.net/man/3/strdup]

[링크 : http://www.unix.com/unix-dummies-questions-answers/100617-how-get-directory-name-its-path.html]

오늘의 교훈 : 쉘에서 되면 당연히 API로도 존재한다!


Posted by 구차니
프로그램 사용/VLC2010. 1. 26. 13:43
youtube는 주소가 아래와 같이 http로 나온다.
http://www.youtube.com/watch?v=Hz86TsGx3fc


혹시나 해서 VLC의 네트워크 스트리밍플레이 기능에 주소를 넣었더니!!


알아서 잘 재생한다 OTL


http://youtube.com/get_video?video_id=Hz86TsGx3fc&t=vjVQa1PpcFPX_-4fVcvo3Rpy39pZ_nwt5-HPSBmsva0%3D
http://youtube.com/get_video?video_id=Hz86TsGx3fc&t=vjVQa1PpcFPs3v8rnDY3-mp1ptSqFzKAem6jcmYB2tY%3D&fmt=35

위의것은 기본 주소로 플레이한 주소이고
아래것은 기본 주소에 &fmt=35 옵션을 주어 플레이한 주소이다.
중간의 파란색은 token 값 같은데 플레이마다 변화되는듯 하다.

유튜브 페이지를 열어서 소스를 보니
    <script type="text/javascript">
        ...
        yt.setConfig({
            'SWF_ARGS':
                   ...
                   {"t": "vjVQa1PpcFPGZu0xo_69WU8f__RZMX6s3tda2xfxQ44%3D"},
                   ...
            });

이런식으로 "t" 변수에 값을 넣어준다.
다른 문서들에 비하면 "&t="를 찾아라고 하는데, 시간이 지나면서 내용이 변경된듯 하다.

아무튼, fmt=35로 하면 아래와 같이 h264로 재생이 된다.


[링크 : http://darksoft.co.kr/410]
[링크 : http://hallang.tistory.com/217]

'프로그램 사용 > VLC' 카테고리의 다른 글

VLC 1.0.4 cross compile + busybox  (0) 2010.02.02
의미는 없는 Linux / Windows VLC 차이  (0) 2010.01.26
youtube mobile on VLC  (0) 2010.01.18
VLC compile [링크]  (0) 2010.01.15
ffmpeg + AMR + x264 + VLC?  (0) 2010.01.14
Posted by 구차니

내가 사용중인 캐릭터는 난도질에 익숙한 리시타이다.
버림받은 남캐(!) 이지만 그래도 꾿꾿이!



그딴거 필요 없다. 노홍철이다 ㄱ-



키보드 조작 기준으로
칼질은
S+D
S+S+D
S+S+S+D
S+S+S+S+D
S+S+S+S+S+S+S+S+...+D (싸우전드 니들)

멱살잡고 배때리기
W+S+D
W+S+S+D
W+S+S+S+D
이런 조작이 가능하다.

S+S+D 이후에 A로 회피가 가능하고 치프틴은 2번 때리고 피하는 조금은
재미없는 전투로 이어나가면 안 맞고 할수 있을것 같다.
Posted by 구차니
개소리 왈왈2010. 1. 25. 22:36
1. 출근했더니 소장님께서 서버 화면 안켜진다고 하시길래
    사람도 없으니 후딱 서버 끄고 확인해보니.. 처참하게 폭발한 캐패시터
    2009.9.15일에 교체한 그래픽 카드가 4달만에 폭발했다...
    덕분에 기안올린다고 정신없는 하루 ㄱ-


콘덴서가 폭발하면서 PCI-Ex에 붙은 잔해

콘덴서가 폭발하면서 그래픽카드에 붙은 잔해

1.5 서버가 날아갔으니 출장용 노트북으로 이전
      물론 서버 이전도 만만찮은 작업.
      nfs랑 LVM mount 하고 복사 걸어 놓으니.. 한 30기가 복사하는데 4시간 걸린듯.
      자다가 깨도 복사가 안끝났어! 상황이랄까 ㄱ-

2. 초대장을 마지막으로 받은게 언제인지도 모를정도로 살다가 맨날 초대장만 주는 공지가 뜨면 징징댔는데
드디어 5장 들어왔다. 우어어어어어!!! 1년 만인가?

'개소리 왈왈' 카테고리의 다른 글

삶이 빡시다  (0) 2010.01.30
오늘도 달댕이  (12) 2010.01.28
아이스크림  (0) 2010.01.22
오늘도..  (0) 2010.01.22
핸드폰 위성추적 해준다고?  (5) 2010.01.20
Posted by 구차니