All posts by admin

zlib

Download zlib-1.2.8.tar.gz

nmake -f win32/Makefile.msc

copy zlib.h zconf.h and zlib.lib

 

int  uncompress3 (int type,Bytef *dest, uLongf *destLen,const Bytef *source,uLong sourceLen) {  int nWindowBites;  if(1==type)  {   nWindowBites=15;  }  else if(2==type)  {   nWindowBites=-15;  }  else  {   nWindowBites=15+16;  }     z_stream stream;     int err;

stream.next_in = (z_const Bytef *)source;     stream.avail_in = (uInt)sourceLen;     /* Check for source > 64K on 16-bit machine: */     if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;

stream.next_out = dest;     stream.avail_out = (uInt)*destLen;     if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;

stream.zalloc = (alloc_func)0;     stream.zfree = (free_func)0;

//err = inflateInit(&stream);  err = inflateInit2 (&stream,nWindowBites);     if (err != Z_OK) return err;

err = inflate(&stream, Z_FINISH);     if (err != Z_STREAM_END) {         inflateEnd(&stream);         if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0))             return Z_DATA_ERROR;         return err;     }     *destLen = stream.total_out;

err = inflateEnd(&stream);     return err; }

int  compress3 (int type,     Bytef *dest,     uLongf *destLen,     const Bytef *source,     uLong sourceLen) {  //type 1 = Deflate, 2= raw, 3 = Gzip  int nWindowBites;  if(1==type)  {   nWindowBites=15;  }  else if(2==type)  {   nWindowBites=-15;  }  else  {   nWindowBites=15+16;  }  z_stream stream;     int err;

stream.next_in = (z_const Bytef *)source;     stream.avail_in = (uInt)sourceLen; #ifdef MAXSEG_64K     /* Check for source > 64K on 16-bit machine: */     if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; #endif     stream.next_out = dest;     stream.avail_out = (uInt)*destLen;     if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;

stream.zalloc = (alloc_func)0;     stream.zfree = (free_func)0;     stream.opaque = (voidpf)0;

//err = deflateInit(&stream, level);    err = deflateInit2(&stream, Z_DEFAULT_COMPRESSION, Z_DEFLATED ,nWindowBites,8,Z_DEFAULT_STRATEGY);

if (err != Z_OK) return err;

err = deflate(&stream, Z_FINISH);     if (err != Z_STREAM_END) {         deflateEnd(&stream);         return err == Z_OK ? Z_BUF_ERROR : err;     }     *destLen = stream.total_out;

err = deflateEnd(&stream);     return err; }

int _tmain(int argc, _TCHAR* argv[]) {  unsigned char arr1[255];  unsigned char arr2[255];  unsigned char arr3[255];  unsigned long nTargetLen=255;  unsigned long nTargetLen2=255;  memset(arr1,0,255);  memset(arr2,0,255);  memcpy(arr1,”hello”,sizeof(“hello”));  int ret=compress3(1,arr2,&nTargetLen,arr1,sizeof(“hello”));

ret=uncompress3(1,arr3,&nTargetLen2,arr2,nTargetLen);

memset(arr3,0,255);  ret=compress3(2,arr2,&nTargetLen,arr1,sizeof(“hello”));

while(Z_BUF_ERROR==uncompress3(2,arr3,&nTargetLen2,arr2,nTargetLen))  {   nTargetLen2*=2;  }  memset(arr3,0,255);

while(Z_BUF_ERROR==compress3(3,arr2,&nTargetLen,arr1,sizeof(“hello”)))  {   nTargetLen*=2;  }  while(Z_BUF_ERROR==uncompress3(3,arr3,&nTargetLen2,arr2,nTargetLen))  {   nTargetLen2*=2;  }

return 0; }

 

WSPRecv

int WSPRecv(
_In_     SOCKET s,
_Inout_  LPWSABUF lpBuffers,
_In_     DWORD dwBufferCount,
_Out_    LPDWORD lpNumberOfBytesRecvd,
_Inout_  LPDWORD lpFlags,
_In_     LPWSAOVERLAPPED lpOverlapped,
_In_     LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
_In_     LPWSATHREADID lpThreadId,
_Out_    LPINT lpErrno
);

WSPSend

WSPSend function

            This topic has not yet been rated – Rate this topic

WSPSend sends data on a connected socket.

Syntax

int WSPSend(
  _In_   SOCKET s,
  _In_   LPWSABUF lpBuffers,
  _In_   DWORD dwBufferCount,
  _Out_  LPDWORD lpNumberOfBytesSent,
  _In_   DWORD dwFlags,
  _In_   LPWSAOVERLAPPED lpOverlapped,
  _In_   LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
  _In_   LPWSATHREADID lpThreadId,
  _Out_  LPINT lpErrno
);

Parameters

s [in]
Descriptor that identifies a connected socket.

lpBuffers [in]
Pointer to an array of      WSABUF structures. This array must remain valid for the     duration of the send operation. Each WSABUF structure describes a buffer. The switch registered each     buffer in a previous call to the      WSPRegisterMemory function.

dwBufferCount [in]
Number of WSABUF structures at      lpBuffers.

lpNumberOfBytesSent [out]
Pointer to a variable that receives the number of bytes that      WSPSend sent.

dwFlags [in]
Must be zero.

lpOverlapped [in]
Pointer to a      WSAOVERLAPPED structure that provides a     communication medium between the initiation of an overlapped I/O operation and its subsequent     completion. Ignored for nonoverlapped sockets.

lpCompletionRoutine [in]
Pointer to the completion routine that the SAN service provider might initiate after the send     operation completes. Ignored for nonoverlapped sockets. The switch specifies NULL for a completion     routine. To see the prototype for a completion routine, see      WSPIoctl.

lpThreadId [in]
Pointer to a      WSATHREADID structure that the SAN service     provider might use in a subsequent call to the      WPUQueueApc function to arrange for the execution of the completion routine at      lpCompletionRoutine. A WSATHREADID structure identifies a thread. Because the switch specifies     NULL for a completion routine, the SAN service provider does not use      lpThreadId. For more information about      WPUQueueApc, see the Microsoft Windows SDK documentation.

lpErrno [out]
Pointer to a variable that receives the error code.

Return value

Returns zero if successful and the send operation completed immediately; otherwise, returns     SOCKET_ERROR and, at      lpErrno, one of the following error codes:

Return code Description
WSAENETDOWN
Network subsystem failed.
WSAEFAULT
The        lpBuffers parameter is not totally contained in a valid part of the user address space.
WSAENOBUFS
SAN service provider reports a buffer deadlock.
WSAENOTCONN
Socket is not connected.
WSAENOTSOCK
Descriptor is not a socket.
WSAESHUTDOWN
Socket has been shut down; it is not possible for the        WSPSend function to send data on a socket after the socket has been shut down.
WSAEINVAL
The switch either did not create the socket with the overlapped flag or previously call the        WSPBind function to bind the socket.
WSAECONNABORTED
The connection to the remote peer was terminated due to a time-out or other failure.
WSAECONNRESET
The connection was reset by the remote peer.
WSA_IO_PENDING
The SAN service provider successfully initiated an overlapped send operation and will indicate       completion at a later time.
WSA_OPERATION_ABORTED
The overlapped operation was canceled, because the socket was closed.

 

Note that a SAN service provider does not support the following error codes for       WSPSend:

Return code Description
WSAEACCES
Broadcast addresses are not supported.
WSAEINPROGRESS
The Windows Sockets switch never issues cancel blocking calls to a SAN service provider.
WSAENETRESET
Detecting a broken connection from the remote host resetting is not supported.
WSAEOPNOTSUPP
The socket is the appropriate type.
WSAEWOULDBLOCK
The Windows Sockets switch uses overlapped sockets.
WSAEMSGSIZE
The current version of Windows Sockets Direct does not support SAN service providers handling       sockets that send datagrams.

 

Remarks

The Windows Sockets switch calls a SAN service provider’s     WSPSend function to transmit data on a connected socket. A SAN service provider receives     WSPSend requests from the switch, but never directly from an application.

Typically during connection setup time, the switch calls the SAN service provider’s     WSPRegisterMemory extension function to    preregister all memory for the buffer array that is the source of the outgoing data.

The switch specifies an overlapped structure and NULL for a completion routine if the switch calls the    SAN service provider’s     WSPSend function in an overlapped manner. The switch calls     WSPSend to post one or more buffers of data for transmission over the network. If the    data-transmission operation cannot complete immediately, the operation proceeds, but     WSPSend returns with the WSA_IO_PENDING error code. The switch later calls the SAN service    provider’s     WSPGetOverlappedResult function and    passes a pointer to the overlapped structure to retrieve the final completion status.

The buffer array that the switch supplies in a     WSPSend call is a pointer to an array of     WSABUF structures. The SAN service provider must    transmit data in buffers in the order in which those buffers appear in the buffer array. The buffer array    is transient. That is, if the     WSPSend call returns without completing the data-transmission operation, the SAN service provider    must capture the pointer to the array of WSABUF structures before returning from     WSPSend. This requirement enables the switch to build stack-based buffer arrays.

The switch does not pass send message requests to the SAN service provider that exceed the size that    the SAN service provider returns in     WSPGetSockOpt calls for the value of the    SO_MAX_MSG_SIZE socket option.

Note that the successful completion of a     WSPSend call does not indicate that the SAN service provider successfully finished delivering data    in the buffer array to the destination.

Overlapped Socket I/O

If the data transmission operation completes immediately, the SAN service provider returns from     WSPSend with a value of zero and specifies the number of bytes transmitted at     lpNumberOfBytesSent. If the SAN service provider successfully initiated the data transmission    operation and will indicate completion at a later time, the SAN service provider returns from     WSPSend with a value of SOCKET_ERROR and specifies the WSA_IO_PENDING error code at     lpErrno. Note that in this case, a value is not specified at     lpNumberOfBytesSent. After the data transmission operation completes, the switch calls the SAN    service provider’s     WSPGetOverlappedResult function and    passes a pointer to a variable to hold data transmission information. The SAN service provider specifies    the number of bytes transmitted in this pointer.

The overlapped structure at     lpOverlapped must be valid for the duration of the data transmission operation. If multiple data    transmission operations are outstanding simultaneously, each must reference a separate overlapped    structure.

As mentioned previously, the switch always specifies an event in an overlapped structure and NULL for    a completion routine if the switch calls the SAN service provider’s     WSPSend function in an overlapped manner. The SAN service provider should call the     WPUCompleteOverlappedRequest function in the context of an arbitrary thread to complete the data    transmission operation. If the low order bit of the     hEvent member in the WSAOVERLAPPED structure is set, the switch specifically requests to not be    notified upon completion of the data transmission operation. Therefore, the SAN service provider is not    required to call the     WPUCompleteOverlappedRequest function to complete the I/O request. In this case, the switch calls    the     WSPGetOverlappedResult function to poll for completion. For more information, see the     GetQueuedCompletionStatus function in the Microsoft Windows SDK documentation.

For more information about     WPUCompleteOverlappedRequest, see the Windows SDK documentation.

The SAN service provider can deliver completion notifications in any order; the SAN service provider    is not required to deliver notifications in the same order that overlapped operations are completed.    However, the SAN service provider transmits data from posted buffers in the same order in which the    switch supplies them.

Stay Hungry. Stay Foolish: Steve Jobs’ speech at Stanford

I am honored to be with you today at your commencement from one of the finest universities in the world. I never graduated from college. Truth be told, this is the closest I’ve gotten to a college graduation. Today I want to tell you three stories from my
life. That’s it. No big deal. Just three stories. The first story is about connecting the dots.

 

 

I dropped out of Reed College after the first 6 months, but then stayed around as a drop-in for another 18 months or so before I really quit. So why did I drop out?

It started before I was born. My biological mother was a young, unwed college graduate student, and she decided to put me up for adoption. She felt very strongly that I should be adopted by college graduates, so everything was all set for me to be adopted at birth by a lawyer and his wife. Except that when I popped out they decided at the last minute that they really wanted a girl. So my parents, who were on a waiting list, got a call in the middle of the night asking: “We have an unexpected baby boy; do you want him?” They said: “Of course.” My biological mother later found out that my mother had never graduated from college and that my father had never graduated from high school. She refused to sign the final adoption papers. She only relented a few months later when my parents promised that I would someday go to college.

And 17 years later I did go to college. But I naively chose a college that was almost as expensive as Stanford, and all of my working-class parents’ savings were being spent on my college tuition. After six months, I couldn’t see the value in it. I had no idea what I wanted to do with my life and no idea how college was going to help me figure it out. And here I was spending all of the money my parents had saved their entire life. So I decided to drop out and trust that it would all work out OK. It was pretty scary at the time, but looking back it was one of the best decisions I ever made. The minute I dropped out I could stop taking the required classes that didn’t interest me, and begin dropping in on the ones that looked interesting.

It wasn’t all romantic. I didn’t have a dorm room, so I slept on the floor in friends’ rooms, I returned coke bottles for the 5¢ deposits to buy food with, and I would walk the 7 miles across town every Sunday night to get one good meal a week at the Hare Krishna temple. I loved it. And much of what I stumbled into by following my curiosity and intuition turned out to be priceless later on. Let me give you one example:

Reed College at that time offered perhaps the best calligraphy instruction in the country. Throughout the campus every poster, every label on every drawer, was beautifully hand calligraphed. Because I had dropped out and didn’t have to take the normal classes, I decided to take a calligraphy class to learn how to do this. I learned about serif and san serif typefaces, about varying the amount of space between different letter combinations, about what makes great typography great. It was beautiful, historical, artistically subtle in a way that science can’t capture, and I found it fascinating.

None of this had even a hope of any practical application in my life. But ten years later, when we were designing the first Macintosh computer, it all came back to me. And we designed it all into the Mac. It was the first computer with beautiful typography. If I had never dropped in on that single course in college, the Mac would have never had multiple typefaces or proportionally spaced fonts. And since Windows just copied the Mac, it’s likely that no personal computer would have them. If I had never dropped out, I would have never dropped in on this calligraphy class, and personal computers might not have the wonderful typography that they do. Of course it was impossible to connect the dots looking forward when I was in college. But it was very, very clear looking backwards ten years later.

Again, you can’t connect the dots looking forward; you can only connect them looking backwards. So you have to trust that the dots will somehow connect in your future. You have to trust in something – your gut, destiny, life, karma, whatever. This approach has never let me down, and it has made all the difference in my life. My second story is about love and loss.

I was lucky – I found what I loved to do early in life. Woz and I started Apple in my parents garage when I was 20. We worked hard, and in 10 years Apple had grown from just the two of us in a garage into a $2 billion company with over 4000 employees. We had just released our finest creation – the Macintosh – a year earlier, and I had just turned 30. And then I got fired. How can you get fired from a company you started? Well, as Apple grew we hired someone who I thought was very talented to run the company with me, and for the first year or so things went well. But then our visions of the future began to diverge and eventually we had a falling out. When we did, our Board of Directors sided with him. So at 30 I was out. And very publicly out. What had been the focus of my entire adult life was gone, and it was devastating.

I really didn’t know what to do for a few months. I felt that I had let the previous generation of entrepreneurs down – that I had dropped the baton as it was being passed to me. I met with David Packard and Bob Noyce and tried to apologize for screwing up so badly. I was a very public failure, and I even thought about running away from the valley. But something slowly began to dawn on me – I still loved what I did. The turn of events at Apple had not changed that one bit. I had been rejected, but I was still in love. And so I decided to start over.

I didn’t see it then, but it turned out that getting fired from Apple was the best thing that could have ever happened to me. The heaviness of being successful was replaced by the lightness of being a beginner again, less sure about everything. It freed me to enter one of the most creative periods of my life.

During the next five years, I started a company named NeXT, another company named Pixar, and fell in love with an amazing woman who would become my wife. Pixar went on to create the worlds first computer animated feature film, Toy Story, and is now the most successful animation studio in the world. In a remarkable turn of events, Apple bought NeXT, I returned to Apple, and the technology we developed at NeXT is at the heart of Apple’s current renaissance. And Laurene and I have a wonderful family together.

I’m pretty sure none of this would have happened if I hadn’t been fired from Apple. It was awful tasting medicine, but I guess the patient needed it. Sometimes life hits you in the head with a brick. Don’t lose faith. I’m convinced that the only thing that kept me going was that I loved what I did. You’ve got to find what you love. And that is as true for your work as it is for your lovers. Your work is going to fill a large part of your life, and the only way to be truly satisfied is to do what you believe is great work. And the only way to do great work is to love what you do. If you haven’t found it yet, keep looking. Don’t settle. As with all matters of the heart, you’ll know when you find it. And, like any great relationship, it just gets better and better as the years roll on. So keep looking until you find it. Don’t settle.

My third story is about death.

When I was 17, I read a quote that went something like: “If you live each day as if it was your last, someday you’ll most certainly be right.” It made an impression on me, and since then, for the past 33 years, I have looked in the mirror every morning and asked myself: “If today were the last day of my life, would I want to do what I am about to do today?” And whenever the answer has been “No” for too many days in a row, I know I need to change something.

Remembering that I’ll be dead soon is the most important tool I’ve ever encountered to help me make the big choices in life. Because almost everything – all external expectations, all pride, all fear of embarrassment or failure – these things just fall away in the face of death, leaving only what is truly important. Remembering that you are going to die is the best way I know to avoid the trap of thinking you have something to lose. You are already naked. There is no reason not to follow your heart. About a year ago I was diagnosed with cancer. I had a scan at 7:30 in the morning, and it clearly showed a tumor on my pancreas. I didn’t even know what a pancreas was. The doctors told me this was almost certainly a type of cancer that is incurable, and that I should expect to live no longer than three to six months. My doctor advised me to go home and get my affairs in order, which is doctor’s code for prepare to die. It means to try to tell your kids everything you thought you’d have the next 10 years to tell them in just a few months. It means to make sure everything is buttoned up so that it will be as easy as possible for your family. It means to say your goodbyes.

I lived with that diagnosis all day. Later that evening I had a biopsy, where they stuck an endoscope down my throat, through my stomach and into my intestines, put a needle into my pancreas and got a few cells from the tumor. I was sedated, but my wife, who was there, told me that when they viewed the cells under a microscope the doctors started crying because it turned out to be a very rare form of pancreatic cancer that is curable with surgery. I had the surgery and I’m fine now.

This was the closest I’ve been to facing death, and I hope it’s the closest I get for a few more decades. Having lived through it, I can now say this to you with a bit more certainty than when death was a useful but purely intellectual concept:

No one wants to die. Even people who want to go to heaven don’t want to die to get there. And yet death is the destination we all share. No one has ever escaped it. And that is as it should be, because Death is very likely the single best invention of Life. It is Life’s change agent. It clears out the old to make way for the new. Right now the new is you, but someday not too long from now, you will gradually become the old and be cleared away. Sorry to be so dramatic, but it is quite true.

Your time is limited, so don’t waste it living someone else’s life. Don’t be trapped by dogma – which is living with the results of other people’s thinking. Don’t let the noise of others’ opinions drown out your own inner voice. And most important, have the courage to follow your heart and intuition. They somehow already know what you truly want to become. Everything else is secondary.

When I was young, there was an amazing publication called The Whole Earth Catalog, which was one of the bibles of my generation. It was created by a fellow named Stewart Brand not far from here in Menlo Park, and he brought it to life with his poetic touch. This was in the late 1960’s, before personal computers and desktop publishing, so it was all made with typewriters, scissors, and polaroid cameras. It was sort of like Google in paperback form, 35 years before Google came along: it was idealistic, and overflowing with neat tools and great notions.

Stewart and his team put out several issues of The Whole Earth Catalog, and then when it had run its course, they put out a final issue. It was the mid-1970s, and I was your age. On the back cover of their final issue was a photograph of an early morning country road, the kind you might find yourself hitchhiking on if you were so adventurous. Beneath it were the words: “Stay Hungry. Stay Foolish.” It was their farewell message as they signed off. Stay Hungry. Stay Foolish. And I have always wished that for myself. And now, as you graduate to begin anew, I wish that for you.

Stay Hungry. Stay Foolish.

Thank you all very much.

孔子问礼

第一次參訪

敬王十七年戊戍,孔子聞老子道風高逸,一日謂南宮敬叔曰:「吾聞老聃,博古談今,通禮樂之原,明道德之歸,是吾師也,今將前往問道。」

南宮敬叔言於魯君,魯君供給了車一輛,馬二匹,僮僕一人,孔子去周,參訪老子。

老子見孔子到來,坐定後,問孔子曰:「吾聞子北方之賢者也,子亦得道乎?」

孔子曰:「未也。」

老子曰:「子惡乎求之哉?」(求的怎樣?)

孔子曰:「求之十幾年而未得也。」

老子曰:「子又惡乎求之?」(向什麽方面去求)

孔子曰:「求之陰陽,十有二年而未得也。」

老子曰:「原來如此,使道而可獻,則人莫不獻之於其君!使道而可進,則人莫不進之於其親!使道而可以告人,則人莫不告其兄弟!使道而可以與人,則人莫不與其子孫!其不可者,無他也,中無主而不立(心中沒有誠信的主宰,不能不動不搖,站穩立定),外無正而不行(外行不端,無法通行運作),由中出者,不受於外,聖人不出;由外人者,無主於中,聖人不隱。」孔子聞言,唯唯拜退。

第二次參訪

過不多久,又去拜見老子,問道:「敢問大道。」

老子曰:「君子得時則駕,不得時則蓬累而行,吾聞之,良賈深藏若虛,君子盛德,容貌若愚,去子驕盈與多欲,態色與淫志,是皆無益於子之身。吾所告子,若此而已。」

孔子聞言,禮謝而去。

第三次參訪

他日,孔子又見老子,向老子暢談仁義。

老子曰:「請問仁義之性?」

孔子曰:「君子不仁則不成,不義則不生,仁義則人之性也。」

老子曰:「請問何謂仁義?」

孔子對曰:「中心物愷,兼愛無私,仁義之情也。」

老子曰:「意,幾乎後言,兼愛不亦迹乎。無私焉,乃私也。夫播糠眯目,則天地四方易位矣,蚊虻噆膚,則通夕不寐矣,吾子使天下無失其樸,則天地固有常矣!日月因有明矣!星辰固有列矣!禽獸固有群矣!物植固有立矣!吾子欲放德而行,循道而趨,已至矣,又何偈偈手揭仁義,若擊鼓而求亡子焉!意吾子其亂人之性也。夫鵠不日浴而白,鳥不日黔而黑,黑白之樸,不足爲辨,名譽之觀,不足爲廣,泉涸、魚相處於陸,相呴以濕,相濡以沫,不若相忘於江湖。請你仔細想想吧!」

孔子歸,三日不開口說話,孔子弟子子貢怪而問道:「老師!你拜訪老子,您對他有何規勸?」

孔子曰:「鳥、吾知其能飛,魚、吾知其能游,獸、吾知其能走,飛者吾可以矰,游者吾可以綸,走者吾可以綱,至於龍、合而成體,散而成章,乘雲氣而上天,吾所不能測也。今見老聃,其猶龍乎!他使我口張而不能嗋,神錯而無所居,吾又如何能對他加以規勸呢!」

第四次參訪

有一天孔子帶領了四位弟子去見老子,在門前不遠之處與老子相遇,老子問孔子曰:「他們是誰?」孔子指著說:「他叫仲由,是個勇而有力之人;他叫曾參,是事親最孝的人;他叫顔回,是位很有仁德的人;最後這個叫顓孫師,他是個武人。」

老子一個個看過之後,向孔子說道:「吾聞南方有鳥,其名曰鳳,鳳鳥的一身,戴聖纓仁,左信右賢,力在足而勇在前,不知與你們比較起來,是否不相上下呢?(指示孔子五人合而爲一之道)。」孔子及諸弟子,聞後,各有所悟。

第五次參訪

一天, 孔子又去拜見老子,問道:「聞古代的祀天,有五帝之神,是否?」

老子曰:「天有五行,木、火、金、水、土,分時化育,協佐上帝,生成萬物。」

孔子曰:「請問何謂五帝?」

老子曰:「東方青帝名威靈仰,執規以司春;南方赤帝名赤熛弩,執衡以司夏;西方白帝名曰昭矩,執矩以司秋;北方黑帝名叶光紀,執權以司冬;中央黃帝名含樞紐,執繩以司四季。故古之王者,易代改號,取法五行五德,更始終及終始相生,因之;古代明王,死後配享於五行,是以太皥配木,炎帝配火,黃帝配土,少皥配金,顓頊配水。」孔子唯唯。

第六次參訪

孔子有一次去見老子,慨歎說道:「行道很難!我執大道周遊各國,而當時各國之君,沒人能肯接受,真是道之難行!」

老子答道:「說者流於辯,聽者亂於辭,知此二者,則大道不可委矣!況子之所言者,其人與骨皆已朽矣!獨其言在耳。詩書禮樂,先王之陳迹也,豈其所以迹哉!夫迹、覆之所出,而迹豈覆哉!夫白鶂相視,眸子不運(不轉睛)而風化蟲,雄鳴於上風,雌應於下風,而風化類(由氣傳其神精而育下一代),自爲雄雌(陰陽)而風化,性不可易,命不可變,時不可止,道不可壅,苟得其道者,無自而不可(任何時間地方皆可與大道合一),失焉者,無自而可(失掉神氣而不能與大道合一的人,在任何時地都無法修持)。」

孔子聽到老子這番深切的指導之後,回到自己的住所,沒有出門,沉靜細參了三個月

第七次參訪

復見老子請益,向老子報道:「丘得之矣(上次所示,其中真理,我得到了)!鳥鵲孺魚傳沫(老鳥捉到魚咬碎連同口水去餵小鳥),細腰者化(魚肉變成細肉進入小鳥腹內化作小鳥的一部分),有弟則兄啼(只餵弟弟,哥哥吃不到則叫),久矣夫,丘不與化(我不知、也不曾啐嚼造化,如老鳥的含魚,爲期已久),爲人不與化,爲人安得化人(做人不去斡旋造化,先度自我,如何能去度化他人)!」

老子點頭示可,說道:「你得道了。」

第八次參訪

孔子得到老子的印可,心中無限怡悅,一天又去參拜老子,適逢老子沐浴方畢,正在披髮,等待水乾,看來長髮散垂,不像人形,孔子見狀,不敢驚動,待在一旁,過了一回,拜見老子說道:「丘也眩歟?其信然歟?方才看到先生形骸,真像個槁木遺物,離開人群而立於幽獨之處?」

老子曰:「是呀!吾游於物之初。」

孔子問曰:「請問何謂物之初?」

老子曰:「心困焉而不能知,口闢焉而不能言,嘗爲議(精思化育),其將至陰肅肅,肅肅出乎天;至陽赫赫,赫赫發乎地,兩者交通成和,而物生焉,成物之紀,莫見其形,消息盈虛,一晦一明,日改月化,有所爲而莫見其功,生有所乎萌,死有所乎歸,始終相反乎無端,而莫知其所。窮是非(善惡之根)也,且孰爲之宗。」

孔子曰:「物之初,既蒙指導矣,請問如何遊於物之初的先天境界?」

老子曰:「得遊於是,乃是至美至樂之事,得至美而遊乎至樂,那是至人(無己忘我)的境界。」

孔子曰:「什麽方法才可以做到?」

老子曰:「食草之獸,不疾易藪,水生之蟲,不疾易水;行小變而不失其大常也。喜怒哀樂不入於胸次。夫天下者,萬物之所一也。得其所一而同焉,則四肢百體,將化爲塵垢;死生終始,將爲畫夜,而莫之能汨(亂也),而況得喪禍福之所介耶!棄隸者(把隸屬之物抛棄),若棄泥塗之身!貴於隸者,貴在於我而不失其變!且萬化而未始有極也。夫孰是以患心哉!?爲道者,解乎此矣!」

孔子聽了老子的「小變大常」暨「得一同萬」以及「塵視有形」、不再置心迷於輪迴旋轉圈子之內的道法,深感受益不淺,良久又問道:「大人德配天地,而猶假至言以修心,古之君子,孰能脫焉?」

老子告之曰:「不然。水之於汋(擊水聲)也,無爲(不擊)而才自然,至人之於德也,不修而物不能離焉,夫天之自高,地之自厚,日月之自明,夫何修焉!(能離物者,本體即返無爲,而自成其本來的博厚高明。)。」

孔子聽了老子這番開示之後,出來遇見顔回,鄭重的告訴顔回道:「丘之於道,其猶醯(醋)雞歟?微夫子之發吾覆(沒有老子的啓迪),吾不知天地之大全也。」

孔子將回返魯國,老子送行,臨別時,謂孔子曰:「吾聞富貴者,送人以財,仁者送人以言,吾既不能富貴,竊仁者之號,今送子以言——凡今之士,聰明深察,而近於死者,發人之惡者也。勿以有已爲人子者也!勿以有已爲人臣者也(爲人臣子者,更不可公開犯上)。」

離別依依之際,孔子又聽了老子大德海涵之旨的教誨之後,敬謝說:「當奉教誨。」

孔子大徹大覺返回魯國之後,其道彌高,四面八方從孔子求學的弟子,增加到三千人,而後著書立說,教化後世,建立了萬世師表的楷模,足見聖聖傳心,何等可貴,見文知事,更應體悟。